25.05.2012, 18:42
pawn Код:
error 003: declaration of a local variable must appear in a compound block
warning 217: loose indentation
error 017: undefined symbol "name2"
warning 215: expression has no effect
error 001: expected token: ";", but found "]"
error 107: too many error messages on one line
Current Code with updated things is:
pawn Код:
if(strcmp(cmd, "/givepassport", true) == 0)
new name2[24];
GetPlayerName(giveplayer, name2, 24);
{
if(IsPlayerConnected(playerid))
{
if(!IsACop(playerid))
{
SendClientMessage(playerid, COLOR_GREY, " You are not a Cop !");
return 1;
}
if(PlayerInfo[playerid][pRank] >= 4)
{
if(PlayerInfo[playerid][pDBanned] == 1)
{
SendClientMessage(playerid, COLOR_CREAM, "You are banned from cop duty.");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_CREAM, "USAGE: /givepassport [playerid]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
GetPlayerName(giveplayerid, sendername, sizeof(sendername));
if(PlayerInfo[giveplayerid][pPassport] == 1) return SendClientMessage(playerid, COLOR_GREY, "This player has a passport already!");
PlayerInfo[giveplayerid][pPassport] = 1;
format(string, sizeof(string),"You gave a passport to %s.",giveplayer);
SendClientMessage(playerid, COLOR_GREY, string);
format(string, sizeof(string),"%s gave you a passport. You are now a citizen..",sendername);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string),"[ADMIN]: %s gave a passport to %s.",sendername,name2);
SendAdminMessage(COLOR_LIGHTRED, string);
new y, m, d;
new h,mi,s;
getdate(y,m,d);
gettime(h,mi,s);
format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /givepassport %s",d,m,y,h,mi,s,giveplayer, sendername);
AdminLog(string);
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " That player is Offline !");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You need to be rank 4 or above.");
return 1;
}
}
return 1;
}