More org help need. - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: More org help need. (
/showthread.php?tid=184486)
More org help need. -
zack3021 - 20.10.2010
Can you tell me what is the problem with my request command? Because when i request different ids, it sill says that i am requesting SAPD.
Example:
/request 1. Will show that i am requesting SAPD
/request 2. Should show that i am requesting SAH but is shows that i am requesting SAPD.
pawn Код:
COMMAND:request(playerid, params[])
{
new id;
if(sscanf(params,"u", id))return SendClientMessage(playerid, 0xFF0000AA, "Usage: /request [orgid]");
new string[MAX_PLAYERS],Name[MAX_PLAYERS];
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!");
format(string,255,"* %s is requesting to join San Andreas Police Dept.",Name);
SendClientMessageToAll(0xFFFFFFFF,string);
request[playerid] = 1;
IsRequesting[playerid] = 1;
{
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!");
format(string,255,"* %s is requesting to join San Andreas Street Racers.",Name);
SendClientMessageToAll(0xFFFFFFFF,string);
request[playerid] = 1;
IsRequesting[playerid] = 1;
}
return 1;
}
}
Re: More org help need. -
zack3021 - 20.10.2010
Please help.
Re: More org help need. -
iggy1 - 20.10.2010
Give this a try (havnt tested need your functions) hope it works
pawn Код:
COMMAND:request(playerid, params[])
{
new id;
if(sscanf(params,"d", id))return SendClientMessage(playerid, 0xFF0000AA, "Usage: /request [orgid]");
new string[128],Name[MAX_PLAYER_NAME];
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!");
if(id == 1)
{
format(string,128,"* %s is requesting to join San Andreas Police Dept.",Name);
SendClientMessageToAll(0xFFFFFFFF,string);
request[playerid] = 1;
IsRequesting[playerid] = 1;
return 1;
}
if(id == 2)
{
format(string,128,"* %s is requesting to join San Andreas Street Racers.",Name);
SendClientMessageToAll(0xFFFFFFFF,string);
request[playerid] = 1;
IsRequesting[playerid] = 1;
}
return 1;
}
Advice: Use the correct size arrays for strings/names. In sscanf the 'u' specifier is for names so use 'd' if its an integer value.
Re: More org help need. -
zack3021 - 20.10.2010
OK will do.
EDIT: Iggy thanks <3 it works.