Hey LEute,
Ich habe ein Probelm mit dem Gurtsystem von benutzername!!!
Hier Die Fehler:
C:\Users\Domi\Saved Games\GTA San Andreas\SAMP SERVER v 2\gamemodes\2012.pwn(20425) : warning 219: local variable "tmp" shadows a variable at a preceding level
C:\Users\Domi\Saved Games\GTA San Andreas\SAMP SERVER v 2\gamemodes\2012.pwn(20428) : error 033: array must be indexed (variable "tmp")
C:\Users\Domi\Saved Games\GTA San Andreas\SAMP SERVER v 2\gamemodes\2012.pwn(20433) : error 033: array must be indexed (variable "tmp")
C:\Users\Domi\Saved Games\GTA San Andreas\SAMP SERVER v 2\gamemodes\2012.pwn(64754) : error 021: symbol already defined: "strtok"
C:\Users\Domi\Saved Games\GTA San Andreas\SAMP SERVER v 2\gamemodes\2012.pwn(64756) : error 017: undefined symbol "length"
C:\Users\Domi\Saved Games\GTA San Andreas\SAMP SERVER v 2\gamemodes\2012.pwn(64762) : error 017: undefined symbol "length"
C:\Users\Domi\Saved Games\GTA San Andreas\SAMP SERVER v 2\gamemodes\2012.pwn(64768) : error 047: array sizes do not match, or destination array is too small
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
6 Errors.
Und Die Zeilen:
Der Befehl:
// Gurt System
cmd = strtok(cmdtext, idx);
if(strcmp("/gurt", cmd, true) == 0)
{
if(!IsPlayerInAnyVehicle(playerid))return SendClientMessage(playerid, ROT, "Du bist in keinem Fahrzeug.");
if(pGurt[playerid] == 0)
{
pGurt[playerid] = 1;
GameTextForPlayer(playerid, "~w~Gurt~n~~g~angelegt", 3000, 6);
return 1;
}
else if(pGurt[playerid] == 1)
{
pGurt[playerid] = 0;
GameTextForPlayer(playerid, "~w~Gurt~n~~r~abgeschnallt", 3000, 6);
return 1;
}
}
// Gurt Kontrollsystem
if(strcmp("/kontrollieregurt", cmd, true) == 0 || strcmp("/kg", cmd, true) == 0)
{
new tmp[256];
tmp = strtok(cmdtext, idx);
if(strlen(tmp) == 0)return SendClientMessage(playerid, ROT, "Benutze: /kg [NAME/ID]");
if(pGurt[tmp] == 0)
{
SendClientMessage(playerid, GELB, "Der Spieler hat keinen Gurt angelegt.");
return 1;
}
else if(pGurt[tmp] == 1)
{
SendClientMessage(playerid, GREEN, "Der Spieler hat den Gurt angelegt.");
return 1;
}
}
Der stock :
// Gurt System
strtok(const string[], &index)
{
new lengt = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
index++;
}
new offset = index;
new result[20];
while((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}