GTAvision.com - Forum - Grand Theft Auto News, Downloads, Community and more...

Position: Grand Theft Auto: San Andreas » Multiplayer » [SA-MP v2] KM/H Anzeige als Textdraw? » Druckansicht
Graf, 29.11.2007, 18:44
Ich will die KM/H Anzeige von Recycler als Textdraw Anzeige machen, aber irgendwie schaff ich es
nicht. Entweder hängt sie oder funktioniert nur wenn ein Player allein drin ist. Kann mir bitte mal
jemand sagen was ich falsch mache? Ich will das die KM/H Anzeige auch zu Fuß funktionniert. Hier
mein letzter Versuch:
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#define SLOTS 100

enum SavePlayerPosEnum {
Float:LastX,
Float:LastY,
Float:LastZ
}

new SpeedMode = 0;
new UpdateSeconds = 1;
new SavePlayerPos[SLOTS][SavePlayerPosEnum];
new Text:darstellungunten[100];
new killsvonplayer[MAX_PLAYERS];
forward UpdateSpeed(playerid);

public UpdateSpeed(playerid){
new Float:x,Float:y,Float:z;
new Float:distance,value,string[256];
for(new i=0; i<SLOTS; i++){
for(new a=0; a<MAX_PLAYERS; a++){
if(IsPlayerConnected(a) ){
TextDrawDestroy(darstellungunten[a]);
GetPlayerPos(i, x, y, z);
distance = floatsqroot(floatpower(floatabs(floatsub(x,SavePlayerPos[i][LastX])),2)+floatpower(floata
bs(floatsub(y,SavePlayerPos[i][LastY])),2)+floatpower(floatabs(floatsub(z,SavePlayerPos[i][LastZ])),
2));
value = floatround(distance * 2500);
if(UpdateSeconds > 1){
value = floatround(value / UpdateSeconds);
}
if(SpeedMode){
format(string,sizeof(string),"~r~%d MPH",floatround(value/1600));
GameTextForPlayer(i, string, 1100, 5);
}
else{
killsvonplayer[a] = GetPlayerScore(a);
format(string,sizeof(string),"~r~Kills:~w~%d ~r~%d ~w~KM/H", killsvonplayer[a], floatround(value/100
0));
darstellungunten[a] = TextDrawCreate(50.0, 420.0, string);
TextDrawLetterSize(darstellungunten[a], 0.5, 2.5);
TextDrawShowForPlayer(a,darstellungunten[a]);
}
}
SavePlayerPos[i][LastX] = x;
SavePlayerPos[i][LastY] = y;
SavePlayerPos[i][LastZ] = z;
}
}
}

SetTimer("UpdateSpeed", UpdateSeconds*1000, 1);
dödel, 29.11.2007, 18:58
Müsste so passen *jop*

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?

public UpdateSpeed(playerid)
{
new stringcar[256];

for(new i=0; i<MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
TextDrawDestroy(carspeed[i]);
}
}

for(new i=0; i<MAX_PLAYERS; i++)
{

if (IsPlayerConnected(i))
{

if(IsPlayerInAnyVehicle(i))
{

new Float:x[MAX_PLAYERS],Float:y[MAX_PLAYERS],Float:z[MAX_PLAYERS];
new Float:distance[MAX_PLAYERS],value[MAX_PLAYERS];

GetPlayerPos(i, x[i], y[i], z[i]);
distance[i] = floatsqroot(floatpower(floatabs(floatsub(x[i],SavePlayerPos[i][LastX])),2)+floatpower(
floatabs(floatsub(y[i],SavePlayerPos[i][LastY])),2)+floatpower(floatabs(floatsub(z[i],SavePlayerPos[
i][LastZ])),2));
value[i] = floatround(distance[i] * 2500);

if(UpdateSeconds > 1){
value[i] = floatround(value[i] / UpdateSeconds);
}

format(stringcar,sizeof(stringcar),"~r~%d ~w~KM/H",floatround(value[i]/1000));

SavePlayerPos[i][LastX] = x[i];
SavePlayerPos[i][LastY] = y[i];
SavePlayerPos[i][LastZ] = z[i];

}
else
{
format(stringcar, sizeof(stringcar)," ");
}

carspeed[i] = TextDrawCreate(270.0, 380.0, stringcar);
TextDrawLetterSize(carspeed[i], 0.5, 2.5);
TextDrawShowForPlayer(i,carspeed[i]);

}

}

}

?>
Graf, 30.11.2007, 16:03
Bei mir gehts jetz. Danke.
GTAvision.com :: Forumregeln :: FAQ :: Impressum :: Kontakt :: RDRvision.com :: LANOIREvision.com :: MaxPayneVision.com
NetVisionWork.NET
.: © 2006-2014 by GTAvision.com :.

Rockstar GamesTake-Two Interactive Deutschland

Free Grand Theft Auto Downloads