SA-MP Forums Archive
Whats is wrong with these commands!? - 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: Whats is wrong with these commands!? (/showthread.php?tid=434587)



Whats is wrong with these commands!? - Don_Cage - 03.05.2013

No matter what command i use i only get "You are not a law member"
this is the commands i added before it started.
pawn Код:
if(strcmp(cmd, "/giveweaponlicense", true) || strcmp(cmd, "/giveweaplic", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(IsACop(playerid))
            {
                if(PlayerInfo[playerid][pRank] >= 5)
                {
                    if(PlayerInfo[playerid][pDBanned] == 1)
                    {
                        SendClientMessage(playerid, COLOR_GREY, "You are Banned from Police Duty!");
                        return 1;
                    }
                    tmp = strtok(cmdtext, idx);
                    if(!strlen(tmp))
                    {
                        SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /giveweaponlicense [playerid/PartOfName]");
                        return 1;
                    }
                    giveplayerid = ReturnUser(tmp);
                    if(IsPlayerConnected(giveplayerid))
                    {
                        if(giveplayerid !=INVALID_PLAYER_ID)
                        {
                            GetPlayerName(giveplayerid, sendername, sizeof(sendername));
                            if(PlayerInfo[giveplayerid][pGunLic] == 1) return SendClientMessage(playerid, COLOR_GREY, "This player already have a weapon license!");
                            PlayerInfo[giveplayerid][pGunLic] = 1;
                            format(string, sizeof(string),"You have given a weapon license to %s.",giveplayer);
                            SendClientMessage(playerid, COLOR_GREY, string);
                            format(string, sizeof(string),"%s Has given you a weapon license!",sendername);
                            SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
                        }
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_GREY,"That player is offline");
                        return 1;
                    }
                }
                else
                {
                    SendClientMessage(playerid, COLOR_GREY,"You must be rank 5+!");
                    return 1;
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY,"You are not a law member!");
                return 1;
            }
        }
        return 1;
    }
and
pawn Код:
if(strcmp(cmd, "/giveofficerlicense", true) || strcmp(cmd, "/givecoplic", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(IsACop(playerid))
            {
                if(PlayerInfo[playerid][pRank] >= 4)
                {
                    if(PlayerInfo[playerid][pDBanned] == 1)
                    {
                        SendClientMessage(playerid, COLOR_GREY, "You are Banned from Police Duty!");
                        return 1;
                    }
                    tmp = strtok(cmdtext, idx);
                    if(!strlen(tmp))
                    {
                        SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /giveofficerlicense [playerid/PartOfName]");
                        return 1;
                    }
                    giveplayerid = ReturnUser(tmp);
                    if(IsPlayerConnected(giveplayerid))
                    {
                        if(giveplayerid !=INVALID_PLAYER_ID)
                        {
                            GetPlayerName(giveplayerid, sendername, sizeof(sendername));
                            if(PlayerInfo[giveplayerid][pCopLic] == 1) return SendClientMessage(playerid, COLOR_GREY, "This player already have officer license!");
                            PlayerInfo[giveplayerid][pCopLic] = 1;
                            format(string, sizeof(string),"You have given officer license to %s.",giveplayer);
                            SendClientMessage(playerid, COLOR_GREY, string);
                            format(string, sizeof(string),"%s Has given you officer license!",sendername);
                            SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
                        }
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_GREY,"That player is offline");
                        return 1;
                    }
                }
                else
                {
                    SendClientMessage(playerid, COLOR_GREY,"You must be rank 5+!");
                    return 1;
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY,"You are not a law member!");
                return 1;
            }
        }
        return 1;
    }



Re: Whats is wrong with these commands!? - SimpalK - 03.05.2013

Here's first cmd :-
pawn Код:
if(strcmp(cmd, "/giveweaponlicense", true) || strcmp(cmd, "/giveweaplic", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(IsACop(playerid))
            {
                    if(PlayerInfo[playerid][pDBanned] == 1)
                    {
                        SendClientMessage(playerid, COLOR_GREY, "You are Banned from Police Duty!");
                        return 1;
                    }
              if(PlayerInfo[playerid][pRank] >= 5)
              {
                    tmp = strtok(cmdtext, idx);
                    if(!strlen(tmp))
                    {
                        SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /giveweaponlicense [playerid/PartOfName]");
                        return 1;
                    }
                    giveplayerid = ReturnUser(tmp);
                    if(IsPlayerConnected(giveplayerid))
                    {
                        if(giveplayerid !=INVALID_PLAYER_ID)
                        {
                            GetPlayerName(giveplayerid, sendername, sizeof(sendername));
                            if(PlayerInfo[giveplayerid][pGunLic] == 1) return SendClientMessage(playerid, COLOR_GREY, "This player already have a weapon license!");
                            PlayerInfo[giveplayerid][pGunLic] = 1;
                            format(string, sizeof(string),"You have given a weapon license to %s.",giveplayer);
                            SendClientMessage(playerid, COLOR_GREY, string);
                            format(string, sizeof(string),"%s Has given you a weapon license!",sendername);
                            SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
                        }
                    }
              }
              if(PlayerInfo[playerid][pRank] < 5)
              {
                 SendClientMessage(playerid, COLOR_GREY,"You must be rank 5+!");
              }
            }
            if(!IsACop(playerid))
            {
                SendClientMessage(playerid, COLOR_GREY,"You are not a law member!");
            }
        }
        if(!IsPlayerConnected(playerid))
        {
           SendClientMessage(playerid, COLOR_GREY,"That player is offline");
        }
    }
    return 1;
}
and 2nd command :-
pawn Код:
if(strcmp(cmd, "/giveofficerlicense", true) || strcmp(cmd, "/givecoplic", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(IsACop(playerid))
            {
                if(PlayerInfo[playerid][pRank] >= 4)
                {
                    if(PlayerInfo[playerid][pDBanned] == 1)
                    {
                        SendClientMessage(playerid, COLOR_GREY, "You are Banned from Police Duty!");
                        return 1;
                    }
                    tmp = strtok(cmdtext, idx);
                    if(!strlen(tmp))
                    {
                        SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /giveofficerlicense [playerid/PartOfName]");
                        return 1;
                    }
                    giveplayerid = ReturnUser(tmp);
                    if(IsPlayerConnected(giveplayerid))
                    {
                        if(giveplayerid !=INVALID_PLAYER_ID)
                        {
                            GetPlayerName(giveplayerid, sendername, sizeof(sendername));
                            if(PlayerInfo[giveplayerid][pCopLic] == 1) return SendClientMessage(playerid, COLOR_GREY, "This player already have officer license!");
                            PlayerInfo[giveplayerid][pCopLic] = 1;
                            format(string, sizeof(string),"You have given officer license to %s.",giveplayer);
                            SendClientMessage(playerid, COLOR_GREY, string);
                            format(string, sizeof(string),"%s Has given you officer license!",sendername);
                            SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
                        }
                    }
                }
                if(PlayerInfo[playerid][pRank] < 4)
                {
                    SendClientMessage(playerid, COLOR_GREY,"You must be rank 5+!");
                }
            }
            if(!IsACop(playerid))
            {
               SendClientMessage(playerid, COLOR_GREY,"You are not a law member!");
            }
        }
        if(!IsPlayerConnected(playerid))
        {
           SendClientMessage(playerid, COLOR_GREY,"That player is offline");
        }
    }
    return 1;
}



Re: Whats is wrong with these commands!? - Don_Cage - 03.05.2013

Looks abit wrong with that codes you gave me, or atleast i think so. That would just make pawno crash i think. But i will try them out