SA-MP Forums Archive
Max robbing level - 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: Max robbing level (/showthread.php?tid=319331)



Max robbing level - SnG.Scot_MisCuDI - 18.02.2012

Im trying to make it so if a player has 6 stars he can not rob until he has less. Here is part of the script.
And if u add it into the script tell me where to add it to the rest of the robbing points (like what u added)
+rep

pawn Код:
if(AmmuRecentlyRobbed == 0)
                    {
                        new chances = random(500);
                        if(chances >= 0 && chances <= 400)
                        {
                            new string[250];
                            RobAmmu[playerid] = 20;
                            AmmuRecentlyRobbed = 150;
                            format(string, sizeof(string), "%s[ID:%d] started a robbery at Ammunation!", name, playerid);
                            Announce(string);
                            return true;
                        }
                        else if(chances >= 401 && chances <= 500)
                        {
                            new copmsg[250];
                            SendClientMessage(playerid, ERROR, "Your attempt to rob Ammunation failed!");
                            SendClientMessage(playerid, ERROR, "The Police are on their way to the store.");
                            SetPlayerWantedLevel(playerid,GetPlayerWantedLevel(playerid)+ 5);
                            format(copmsg, sizeof(copmsg), "[HQ] %s attemped to rob Ammunation.", name);
                            SendRadioMessageToCops(copmsg);
                            AmmuRecentlyRobbed = 100;
                            return true;
                        }
                    }
                    else if(AmmuRecentlyRobbed > 0) return SendClientMessage(playerid, ERROR, "Ammunation has been robbed recently!");
            }
            else SendClientMessage(playerid, ERROR, "Your team cannot rob anything.");
        }



Re: Max robbing level - Twisted_Insane - 18.02.2012

pawn Код:
if(GetPlayerWantedLevel == 6)
return SendClientMessage(playerid,COLOR,"Bla, text here!");
else if(GetPlayerWantedLevel < 6)
//your robbing-code
Should worked, typed in a hurry!


Re: Max robbing level - SnG.Scot_MisCuDI - 18.02.2012

pawn Код:
(2721) : error 076: syntax error in the expression, or invalid function call
(2723) : error 076: syntax error in the expression, or invalid function call
pawn Код:
if(GetPlayerWantedLevel == 6)
else if(GetPlayerWantedLevel < 6)



Re: Max robbing level - Twisted_Insane - 18.02.2012

My bad, do it like that, I don't know this function too well, but delete everything what I gave you and try this:

pawn Код:
new WLevel;
GetPlayerWantedLevel(playerid, WLevel);
if(WLevel == 6) return SendClientMessage(playerid,COLOR_RED,"You need to have a lower wantedlevel to continue!");
else if(WLevel < 6)
//The rest of your code here, what should continue, bla
Hope I could help this time better!


Re: Max robbing level - SnG.Scot_MisCuDI - 18.02.2012

pawn Код:
GetPlayerWantedLevel(playerid, WLevel);
pawn Код:
warning 202: number of arguments does not match definition
doesnt work

pawn Код:
WLevel = GetPlayerWantedLevel(playerid);
            if(WLevel == 6) return SendClientMessage(playerid,COLOR_RED,"You need to have a lower wantedlevel to continue!");
            else if(WLevel < 6)
tried with that but also didnt work


Re: Max robbing level - Madd Kat - 18.02.2012

Quote:
Originally Posted by SnG.Scot_MisCuDI
Посмотреть сообщение
pawn Код:
WLevel = GetPlayerWantedLevel(playerid);
            if(WLevel == 6) return SendClientMessage(playerid,COLOR_RED,"You need to have a lower wantedlevel to continue!");
            else if(WLevel < 6)
tried with that but also didnt work
try the printf the WLevel var and see what it holds...


Re: Max robbing level - SnG.Scot_MisCuDI - 18.02.2012

i dont understand printf


Re: Max robbing level - IstuntmanI - 18.02.2012

Try this:
pawn Код:
if(AmmuRecentlyRobbed == 0)
                    {
                        if( GetPlayerWantedLevel( playerid ) >= 6 )
                            return SendClientMessage( playerid, -1, "You must to have less wanted stars to rob the ammunation !" );

                        new chances = random(500);
                        if(chances >= 0 && chances <= 400)
                        {
                            new string[250];
                            RobAmmu[playerid] = 20;
                            AmmuRecentlyRobbed = 150;
                            format(string, sizeof(string), "%s[ID:%d] started a robbery at Ammunation!", name, playerid);
                            Announce(string);
                            return true;
                        }
                        else if(chances >= 401 && chances <= 500)
                        {
                            new copmsg[250];
                            SendClientMessage(playerid, ERROR, "Your attempt to rob Ammunation failed!");
                            SendClientMessage(playerid, ERROR, "The Police are on their way to the store.");
                            SetPlayerWantedLevel(playerid,GetPlayerWantedLevel(playerid)+ 5);
                            format(copmsg, sizeof(copmsg), "[HQ] %s attemped to rob Ammunation.", name);
                            SendRadioMessageToCops(copmsg);
                            AmmuRecentlyRobbed = 100;
                            return true;
                        }
                    }
                    else if(AmmuRecentlyRobbed > 0) return SendClientMessage(playerid, ERROR, "Ammunation has been robbed recently!");
            }
            else SendClientMessage(playerid, ERROR, "Your team cannot rob anything.");
        }
I just added
pawn Код:
if( GetPlayerWantedLevel( playerid ) >= 6 )
                            return SendClientMessage( playerid, -1, "You must to have less wanted stars to rob the ammunation !" );



Re: Max robbing level - SnG.Scot_MisCuDI - 18.02.2012

Quote:
Originally Posted by costel_nistor96
Посмотреть сообщение
Try this:
pawn Код:
if(AmmuRecentlyRobbed == 0)
                    {
                        if( GetPlayerWantedLevel( playerid ) >= 6 )
                            return SendClientMessage( playerid, -1, "You must to have less wanted stars to rob the ammunation !" );

                        new chances = random(500);
                        if(chances >= 0 && chances <= 400)
                        {
                            new string[250];
                            RobAmmu[playerid] = 20;
                            AmmuRecentlyRobbed = 150;
                            format(string, sizeof(string), "%s[ID:%d] started a robbery at Ammunation!", name, playerid);
                            Announce(string);
                            return true;
                        }
                        else if(chances >= 401 && chances <= 500)
                        {
                            new copmsg[250];
                            SendClientMessage(playerid, ERROR, "Your attempt to rob Ammunation failed!");
                            SendClientMessage(playerid, ERROR, "The Police are on their way to the store.");
                            SetPlayerWantedLevel(playerid,GetPlayerWantedLevel(playerid)+ 5);
                            format(copmsg, sizeof(copmsg), "[HQ] %s attemped to rob Ammunation.", name);
                            SendRadioMessageToCops(copmsg);
                            AmmuRecentlyRobbed = 100;
                            return true;
                        }
                    }
                    else if(AmmuRecentlyRobbed > 0) return SendClientMessage(playerid, ERROR, "Ammunation has been robbed recently!");
            }
            else SendClientMessage(playerid, ERROR, "Your team cannot rob anything.");
        }
I just added
pawn Код:
if( GetPlayerWantedLevel( playerid ) >= 6 )
                            return SendClientMessage( playerid, -1, "You must to have less wanted stars to rob the ammunation !" );
No errors or warnings, but it still allows the player to rob


Re: Max robbing level - IstuntmanI - 18.02.2012

Quote:
Originally Posted by SnG.Scot_MisCuDI
Посмотреть сообщение
No errors or warnings, but it still allows the player to rob
You have scripted a scripted wanted level ?