SA-MP Forums Archive
Zcmd help please - 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: Zcmd help please (/showthread.php?tid=338748)



Zcmd help please - Tom1412 - 30.04.2012

hi im trieing to make a /setgang command but i can't get it to work.


pawn Код:
CMD:setgang(playerid,params[])
{
        if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid,COLOR_RED,"You Are not admin level 2");
        new id, Gangid;
        if(sscanf(params,"uc", id, Gangid)) return SendClientMessage(playerid,COLOR_RED,"USAGE: /MakeGang [playerid] [gangid]");
        else if(Gangid > 0 || Gangid < 2) return SendClientMessage(playerid,COLOR_RED,"ERROR: Invalid gang ID!");
        else if(Gangid == PlayerInfo[playerid][pGang]) return SendClientMessage(playerid,COLOR_RED,"ERROR: That player is all ready in that gang.");
        else
        {
            new string [64];
            new INI:File = INI_Open(UserPath(playerid));
            INI_SetTag(File,"data");
            INI_WriteInt(File,"Gang",Gangid);
            INI_Close(File);
            format(string, sizeof(string), "Your gangid now is %s", Gangid);
            SendClientMessage(id,COLOR_BLUE, string);
        }
        return 1;
}



Re: Zcmd help please - WarriorEd22 - 01.05.2012

Are you getting any errors?


Re: Zcmd help please - Tom1412 - 01.05.2012

nope but when i try n use the command i just get /makegang [playerid] [gangid]


Re: Zcmd help please - ReneG - 01.05.2012

Why are you using "uc"? The c specifier is for a character, not an integer.

pawn Код:
if(sscanf(params,"ud", id, Gangid)) return SendClientMessage(playerid,COLOR_RED,"USAGE: /MakeGang [playerid] [gangid]");



Re: Zcmd help please - SuperViper - 01.05.2012

Code does exactly what you tell it to do and you told it to say MakeGang instead of SetGang.

Change this

pawn Код:
if(sscanf(params,"uc", id, Gangid)) return SendClientMessage(playerid,COLOR_RED,"USAGE: /MakeGang [playerid] [gangid]");
to

pawn Код:
if(sscanf(params,"uc", id, Gangid)) return SendClientMessage(playerid,COLOR_RED,"USAGE: /SetGang [playerid] [gangid]");



Re: Zcmd help please - ReneG - 01.05.2012

Quote:
Originally Posted by SuperViper
Посмотреть сообщение
Code does exactly what you tell it to do and you told it to say MakeGang instead of SetGang.

Change this

pawn Код:
if(sscanf(params,"uc", id, Gangid)) return SendClientMessage(playerid,COLOR_RED,"USAGE: /MakeGang [playerid] [gangid]");
to

pawn Код:
if(sscanf(params,"uc", id, Gangid)) return SendClientMessage(playerid,COLOR_RED,"USAGE: /SetGang [playerid] [gangid]");
Those two codes are both the same, I hope you noticed.


Re: Zcmd help please - Tom1412 - 01.05.2012

I posted cos i don't understand that bit, i know how to do it with one but on the other.