lil help - 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: lil help (
/showthread.php?tid=241245)
createorg help -
tanush - 17.03.2011
Im making an dynamic org creator but when i create and set someone leader, they wont get guns
pawn Код:
CMD:createorg(playerid, params[])
{
new str[256],id,wep1,wep2,wep3,name;
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,0xFFFFFFAA, "SERVER: Unknown command.");
if(sscanf(params,"uddds",id,wep1,wep2,wep3,name))return SendClientMessage(playerid,0xFF9900AA, "USAGE: /createorg [leader] [wep1] [wep2] [wep3] [name]");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid,0xFF0000FF, "That user is not connected.");
GivePlayerWeapon(id,wep1,5000);
GivePlayerWeapon(id,wep2,5000);
GivePlayerWeapon(id,wep3,5000);
format(str, sizeof(str),"An Admin has set you leader of %s!",name);
SendClientMessage(playerid,0xFF9900AA,str);
return 1;
}
Re: lil help -
Jochemd - 17.03.2011
Do you receive the SendClientMessage?
Re: lil help -
tanush - 17.03.2011
yes i did, only the weapons 1 2 3 are bugged
Re: lil help -
-Rebel Son- - 17.03.2011
I see your using a variable, "id" Is that for the player? if so why dont you use playerid.
Re: lil help -
tanush - 17.03.2011
Actually id = the other player
Re: lil help -
Medal Of Honor team - 17.03.2011
Re: lil help -
Calgon - 17.03.2011
Quote:
Originally Posted by Medal Of Honor team
|
No, because that'll obtain EVERY character of the string and try convert it in to an integer.
You defined 'name' as an integer, when it's a string.
pawn Код:
CMD:createorg(playerid, params[])
{
new str[59],id,wep1,wep2,wep3,name[24];
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,0xFFFFFFAA, "SERVER: Unknown command.");
if(sscanf(params,"uddds[24]",id,wep1,wep2,wep3,name))return SendClientMessage(playerid,0xFF9900AA, "USAGE: /createorg [leader] [wep1] [wep2] [wep3] [name]");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid,0xFF0000FF, "That user is not connected.");
GivePlayerWeapon(id,wep1,5000);
GivePlayerWeapon(id,wep2,5000);
GivePlayerWeapon(id,wep3,5000);
format(str, sizeof(str),"An Admin has set you leader of %s!",name);
SendClientMessage(playerid,0xFF9900AA,str);
return 1;
}
Re: lil help -
tanush - 17.03.2011
everything is fine!! only weapon 1 2 3 is dont working
Re: lil help -
Calgon - 17.03.2011
Yes! Try the updated code and it'll probably fix the problem because sscanf couldn't properly parse your string!
Re: lil help -
tanush - 17.03.2011
ok thanks