Hallo,
ich wollte grade ein Votekick system bei mir einbauen, doch da kam ein Error, hier die Zeilen:
if(strcmp(cmd, "/votekick", true) == 0)
{
if(PlayerInfo[playerid][pAdmin] >= 1)
{
SendClientMessage(playerid, RED, "ERROR: Du bist kein Admin");
return 1;
}
if(Wait[playerid] == 1) return SendClientMessage(playerid, RED, "Bitte warte 30 Sekunden bis du erneut Voten kannst");
for (new i = 0; i < GetMaxPlayers(); i++)
new reason[256];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, ORANGE, "USAGE: /votekick [ID/PartOfName] [Grund]");
SendClientMessage(playerid, ORANGE, "FUNCTION: Es startet ein Timer, in dieser Zeit kann man voten. (30 Sekunden)");
return 1;
}
if(VoteKick == 1)
{
SendClientMessage(playerid, RED, "ERROR: Es wird schon für einen Spieler gevotet, bitte warte bis dieser Vote vorbei ist");
return 1;
}
giveplayerid = ReturnUser(tmp);
if(giveplayerid != INVALID_PLAYER_ID)
{
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
while ((idx < length) && ((idx - offset) < (sizeof(reason) - 1)))
{
reason[idx - offset] = cmdtext[idx];
idx++;
}
reason[idx - offset] = EOS;
if(!strlen(reason))
{
SendClientMessage(playerid, ORANGE, "USAGE: /votekick [ID/PartOfName] [grund]");
return 1;
}
else
{
format(string, sizeof(string), "[NEWS]: Spieler %s hat einen Votekick gestartet an %s. [Grund: %s] - %d sekunden noch.", Name(playerid), Name(giveplayerid), reason, VOTETIME / 1000);
print(string);
SendClientMessageToAll(YELLOW, string);
SendClientMessageToAll(YELLOW, "Willst du diesen spieler kicken? Benutze /vote");
Votes = 1;
SetTimerEx("VoteTimer", VOTETIME, 0, "i", giveplayerid);
VoteKick = 1;
Voted[playerid] = 1;
Wait[playerid] = 1;
SetTimerEx("WaitT", WAIT_TIME, 0, "d", playerid);
}
}
else if(giveplayerid == INVALID_PLAYER_ID)
{
format(string, sizeof(string), "%d ist nicht online.", giveplayerid);
SendClientMessage(playerid, RED, string);
}
return 1;
}
Es handelt sich um die Errors:
C:\Users\Max\Desktop\Serverg\gamemodes\gm.pwn(15374) : error 003: declaration of a local variable must appear in a compound block
C:\Users\Max\Desktop\Serverg\gamemodes\gm.pwn(15374) : error 017: undefined symbol "reason"
C:\Users\Max\Desktop\Serverg\gamemodes\gm.pwn(15374) : warning 215: expression has no effect
C:\Users\Max\Desktop\Serverg\gamemodes\gm.pwn(15374) : error 001: expected token: ";", but found "]"
C:\Users\Max\Desktop\Serverg\gamemodes\gm.pwn(15374) : fatal error 107: too many error messages on one line
Die Zeile 15374 lautet:
new reason[256];
Hoffentlich könnt ihr mir schnell helfen, da es sehr wichtig ist.
MfG. Cody09