uhh need help with gate pw...
#1

Need help with this cmd .. I is changing all gates pws not ones... could I ask for help..

I think something about looping..
pawn Код:
CMD:admingatepw(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pShopTech] == 1)
    {
        new string[128], gateid, pass[24];
        if(sscanf(params, "ds[24]", gateid, pass)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /admingatepw [gateid] [pass]");

        if(strlen(pass) > 24)
        {
            SendClientMessageEx(playerid, COLOR_GRAD2, " Must be 24 characters or less! ");
            return 1;
        }
        format(string, sizeof(string), "Gate Password for gate %d changed to %s", gateid, pass);
        format(GateInfo[gateid][gPass], 24, "%s", pass);
        SendClientMessageEx(playerid, COLOR_GRAD2, string);
        SaveGates();
    }
    else
    {
        SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
        return 1;
    }
    return 1;
}
Reply
#2

This should work, you don't need to format to assign a variable, you could simply use the code like my one, you might notice that I also used Multiple Actions to shorten the code.

pawn Код:
CMD:admingatepw(playerid, params[])
{
   
    new
        string[128], gateid, pass[24];

    if(sscanf(params, "ds[24]", gateid, pass))
        return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /admingatepw [gateid] [pass]");

    if(PlayerInfo[playerid][pAdmin] < 4 && PlayerInfo[playerid][pShopTech] != 1)
        return SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");

    if(strlen(pass) > 24)  
        return SendClientMessageEx(playerid, COLOR_GRAD2, " Must be 24 characters or less! ");
       
    format(string, sizeof(string), "Gate Password for gate %d changed to %s", gateid, pass), SendClientMessageEx(playerid, COLOR_GRAD2, string);
    GateInfo[gateid][gPass] = pass, SaveGates();
    return 1;
}
Reply
#3

Got some error in that cmd what you gived..
pawn Код:
: error 029: invalid expression, assumed zero
: warning 215: expression has no effect
: error 001: expected token: ";", but found ")"
: error 029: invalid expression, assumed zero
: fatal error 107: too many error messages on one line
pawn Код:
CMD:admingatepw(playerid, params[])
{
    new string[128], gateid, pass[24];
    if(sscanf(params, "ds[24]", gateid, pass))
    return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /admingatepw [gateid] [pass]");
    if(PlayerInfo[playerid][pAdmin] < && PlayerInfo[playerid][pShopTech] != 1)//this line
    return SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
    if(strlen(pass) >= 24)
    return SendClientMessageEx(playerid, COLOR_GRAD2, "Must be 24 characters or less!");
    format(string, sizeof(string), "Gate Password for gate %d changed to %s", gateid, pass), SendClientMessageEx(playerid, COLOR_GRAD2, string);
    GateInfo[gateid][gPass] = pass, SaveGates();
    return 1;
}
Reply
#4

pawn Код:
if(PlayerInfo[playerid][pAdmin] < && PlayerInfo[playerid][pShopTech] != 1)//this line
You say: if their admin level is smaller than.. but there is no 2nd element of the comparison...

Should be:
pawn Код:
if(PlayerInfo[playerid][pAdmin] < 4 && PlayerInfo[playerid][pShopTech] != 1)//Idk what it should be, but I assume it is 4?
Reply
#5

Ohhh... Thanks I got it mate
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)