11.01.2011, 02:21
Seems like there's something wrong with your ZCMD. Anyways this code should work:
Even tho' there's a much more efficent way to do it.
This should also work if you rewrite some of your code:
pawn Код:
COMMAND:request(playerid, params[])
{
new fid;
if(sscanf(params,"i ", fid))return SendClientMessage(playerid, 0xFF0000AA, "Usage: /request [orgid]");
GetPlayerName(playerid, Name, sizeof(Name));
if(IsInOrg[playerid] == 1) return SendClientMessage(playerid, red," You are already in a organisation!");
if(IsRequesting[playerid] == 1) return SendClientMessage(playerid, red," You are already requesting to join an organisation!");
switch(fid)
{
case 1:
{
format(String,MAX_PLAYERS,"* %s is requesting to join San Andreas Police Dept.",Name);
SendClientMessageToAll(SAPD_COLOR,String);
IsRequesting[playerid] = 1;
request[playerid] = 1;
return 1;
}
case 2:
{
format(String,MAX_PLAYERS,"* %s is requesting to join San Andreas Street Racers.",Name);
SendClientMessageToAll(SASR_COLOR,String);
IsRequesting[playerid] = 1;
request[playerid] = 2;
return 1;
}
case 3:
{
format(String,MAX_PLAYERS,"* %s is requesting to join Hitmen.",Name);
SendClientMessageToAll(HITMAN_COLOR,String);
IsRequesting[playerid] = 1;
request[playerid] = 2; // I believe this should be 3?
return 1;
}
case 4:
{
format(String,MAX_PLAYERS,"* %s is requesting to join The National Guard.",Name);
SendClientMessageToAll(NG_COLOR,String);
IsRequesting[playerid] = 1;
request[playerid] = 2; // and this 4 maybe?
return 1;
}
}
return 1;
}
This should also work if you rewrite some of your code:
pawn Код:
COMMAND:request(playerid, params[])
{
new fid;
if(sscanf(params,"i ", fid))return SendClientMessage(playerid, 0xFF0000AA, "Usage: /request [orgid]");
GetPlayerName(playerid, Name, sizeof(Name));
if(IsInOrg[playerid] == 1) return SendClientMessage(playerid, red," You are already in a organisation!");
if(request[playerid] > 0) return SendClientMessage(playerid, red," You are already requesting to join an organisation!");
if(fid < 1 || fid > 4) return SendClientMessage(playerid, red, " Invalid organisation id, must be between 1-4!");
switch(fid)
{
case 1:
{
format(String,MAX_PLAYERS,"* %s is requesting to join San Andreas Police Dept.",Name);
SendClientMessageToAll(SAPD_COLOR,String);
}
case 2:
{
format(String,MAX_PLAYERS,"* %s is requesting to join San Andreas Street Racers.",Name);
SendClientMessageToAll(SASR_COLOR,String);
}
case 3:
{
format(String,MAX_PLAYERS,"* %s is requesting to join Hitmen.",Name);
SendClientMessageToAll(HITMAN_COLOR,String);
}
case 4:
{
format(String,MAX_PLAYERS,"* %s is requesting to join The National Guard.",Name);
SendClientMessageToAll(NG_COLOR,String);
}
}
request[playerid] = fid;
return 1;
}