/makeleader - 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)
+--- Thread: /makeleader (
/showthread.php?tid=545407)
/makeleader -
mkmk - 08.11.2014
How am I able to create a /makeleader command? I believe you need the following to help me.
Re: /makeleader -
Sabur - 08.11.2014
Alright.
We gotta use sscanf for it.
Код:
CMD:makeleader(playerid, params[]) // ZCMD
{
new Id, fId; // Id is gonna stand for targetid and fId is for faction Id.
if(!admin varible) return SendClientMessage(playerid, -1, "You are not an admin!");
if(!IsPlayerConnected(Id)) return SendClientMessage(playerid, -1, "The player is not online!");
if(sscanf(params, "dd", Id, fId) return SendClientMessage(playerid, -1, "USAGE: /makeleader [playerid/partofname] [faction id]");
RSCD[Id] = fId;
return 1;
}
Re: /makeleader -
Stinged - 08.11.2014
Sabur, your command has a bug in it.
You should the IsPlayerConencted line UNDER sscanf, as Id = 0 when you don't assign it to something.
Re: /makeleader -
mkmk - 08.11.2014
Quote:
Originally Posted by Sabur
Alright.
We gotta use sscanf for it.
Код:
CMD:makeleader(playerid, params[]) // ZCMD
{
new Id, fId; // Id is gonna stand for targetid and fId is for faction Id.
if(!admin varible) return SendClientMessage(playerid, -1, "You are not an admin!");
if(!IsPlayerConnected(Id)) return SendClientMessage(playerid, -1, "The player is not online!");
if(sscanf(params, "dd", Id, fId) return SendClientMessage(playerid, -1, "USAGE: /makeleader [playerid/partofname] [faction id]");
RSCD[Id] = fId;
return 1;
}
|
Thanks bro, +rep. But it's not working lol.
Re: /makeleader -
Sabur - 08.11.2014
Quote:
Originally Posted by mkmk
Thanks bro, +rep. But it's not working lol.
|
Make sure you got the right variable.
Re: /makeleader -
mkmk - 08.11.2014
Quote:
Originally Posted by Sabur
Make sure you got the right variable.
|
I did.
Re: /makeleader -
sammp - 08.11.2014
pawn Код:
CMD:makeleader(playerid, params[])
{
new id, fID;
if(sscanf(params, "dd", id)) return SendClientMessage(playerid, -1, "Usage: /makeleader <playerid> <factionid>")
{
if(id != INVALID_PLAYER_ID)
{
if(!strcmp(fID, "1"))
{
RCSD[id] = 1;
}
if(!strcmp(fID, "2"))
{
RCSD[id] = FACTION_ID_2;
}
}
else return SendClientMessage(playerid, -1, "Player not connected");
}
}
Re: /makeleader -
Sabur - 08.11.2014
Quote:
Originally Posted by Stinged
Sabur, your command has a bug in it.
You should the IsPlayerConencted line UNDER sscanf, as Id = 0 when you don't assign it to something.
|
Oh, Thanks for pointing it out!
Re: /makeleader -
dominik523 - 08.11.2014
Quote:
Originally Posted by sammp
pawn Код:
CMD:makeleader(playerid, params[]) { new id, fID;
if(sscanf(params, "dd", id)) return SendClientMessage(playerid, -1, "Usage: /makeleader <playerid> <factionid>") { if(id != INVALID_PLAYER_ID) { if(!strcmp(fID, "1")) { RCSD[id] = 1; } if(!strcmp(fID, "2")) { RCSD[id] = FACTION_ID_2; } } else return SendClientMessage(playerid, -1, "Player not connected"); } }
|
What the hell? You are going to use strcmp and you already have sscanf?
Код:
if(sscanf(params, "dd", id, fID))
Re: /makeleader -
sammp - 08.11.2014
woops i posted that when I just woke up, lol I see the problem XD
I'm a fucking idiot, lol.