Zcmd help please
#1

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;
}
Reply
#2

Are you getting any errors?
Reply
#3

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

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]");
Reply
#5

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]");
Reply
#6

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.
Reply
#7

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


Forum Jump:


Users browsing this thread: 1 Guest(s)