08.01.2012, 14:55
pawn Код:
CMD:request(playerid,params[])
{
if(sscanf(params,"i",orgid)) return SCM(playerid,grey,"USAGE: /request [orgid]");
if(!DoesOrgExist(orgid))return SCM(playerid,red,"That organization does not exist.");
if(request[playerid] != -255) return SCM(playerid,red,"ERROR: You are requesting for an organization already.");
if(PlayerData[playerid][Member] != -255) return SCM(playerid,red,"ERROR: You are in an organization");
for(new i = 0; i <MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && PlayerData[i][Leader] == 1 && PlayerData[i][Member] == orgid)
{
GetPlayerName(playerid,Nam,sizeof(Nam));
request[playerid] = orgid;
format(str,sizeof(str),"%s is requesting to join your organization, use /accept to accept them",Nam);
SendClientMessageToAll(COLOR_LIGHTBLUE,str);
return 1;
}
else
{
SCM(playerid,red,"ERROR: That organization leader is not connected");
}
}
return 1;
}
CMD:cancelrequest(playerid,params[])
{
if(request[playerid] == -255) SCM(playerid,red,"ERROR: You are not requesting for anything");
if(PlayerData[playerid][Member] != -255) return SCM(playerid,red,"ERROR: You are in a organization");
request[playerid] = -255;
SCM(playerid,COLOR_LIGHTBLUE,"You have stopped requesting for that organization");
return 1;
}
Another problem is when i use /cancelrequest while my request is -255 it shows
ERROR: You are not requesting for anything. Under that it shows
You have stopped requesting for that organization