SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 15/08/2019, 08:17 PM   #1
KeyOfKey
Huge Clucker
 
KeyOfKey's Avatar
 
Join Date: Apr 2019
Posts: 339
Reputation: 12
Default Doubt

I'm giving a wanted level to killerid based on which class the victim was on death:

pawn Code:
switch(ReturnPlayerClass(playerid)) //Get the class of the victim.
        {
            case CLASS_CIVILIAN:
            {
                format(TinyString, sizeof(TinyString), "Murder - %s (%d)", ReturnPlayerName(playerid), playerid);
                GivePlayerWantedLevel(killerid, MURDER, TinyString);   
            }

            case CLASS_LAW:
            {
                format(MediumString, sizeof(MediumString), "Law Enforcement Officer Murder - %s (%d)", ReturnPlayerName(playerid), playerid);
                GivePlayerWantedLevel(killerid, LEO_MURDER, MediumString)
            }
        }

So if victim is a civilian, give killer only "Murder" wanted level, or if it's a LEO, give killer the LEO_MURDER level.

Problem is, if i'm a LEO and i kill a civilian/another LEO i'll still get wanted level, is there a way to prevent this?

I don't want LEO's get wanted level, i wanna punish them. I wanna give wanted level just to killers in CIVILIAN class.
KeyOfKey is online now   Reply With Quote
Old 15/08/2019, 08:35 PM   #2
Plastikmensch
Huge Clucker
 
Join Date: Aug 2016
Posts: 251
Reputation: 16
Default Re: Doubt

Hmh... also check the class of the killerid?
inside your cases, do
Code:
if(ReturnPlayerClass(killerid) == CLASS_LAW)
{
   //Punish them
}
else
{
   //Give wanted level
}
Plastikmensch is offline   Reply With Quote
Old 15/08/2019, 08:39 PM   #3
KeyOfKey
Huge Clucker
 
KeyOfKey's Avatar
 
Join Date: Apr 2019
Posts: 339
Reputation: 12
Default Re: Doubt

I tried already, with that code i'll not even get the wanted level lol.
KeyOfKey is online now   Reply With Quote
Old 15/08/2019, 08:40 PM   #4
Plastikmensch
Huge Clucker
 
Join Date: Aug 2016
Posts: 251
Reputation: 16
Default Re: Doubt

Did you check that killerid is valid before using it?
Plastikmensch is offline   Reply With Quote
Old 16/08/2019, 05:33 AM   #5
GTLS
High-roller
 
GTLS's Avatar
 
Join Date: Aug 2014
Location: India
Posts: 1,019
Reputation: 115
Default Re: Doubt

pawn Code:
if(ReturnPlayerClass(killerid) != CLASS_LAW)
{
      switch(ReturnPlayerClass(playerid)) //Get the class of the victim.
        {
            case CLASS_CIVILIAN:
            {
                format(TinyString, sizeof(TinyString), "Murder - %s (%d)", ReturnPlayerName(playerid), playerid);
                GivePlayerWantedLevel(killerid, MURDER, TinyString);    
            }

            case CLASS_LAW:
            {
                format(MediumString, sizeof(MediumString), "Law Enforcement Officer Murder - %s (%d)", ReturnPlayerName(playerid), playerid);
                GivePlayerWantedLevel(killerid, LEO_MURDER, MediumString);  
            }
        }
}

Try
__________________

I don't help for rep. I help cuz I was helped in the past.


Retired from SAMP Scene. Might open SAMP Forums once in a while.

Some treats for ya. Click em
Basic House System
Simple Speedo
Base Login/Register Script

GTLS is offline   Reply With Quote
Old 16/08/2019, 02:52 PM   #6
SiaReyes
Huge Clucker
 
SiaReyes's Avatar
 
Join Date: Mar 2019
Location: Coordinates X,Y,Z
Posts: 265
Reputation: 19
Default Re: Doubt

Quote:
Originally Posted by GTLS View Post
pawn Code:
if(ReturnPlayerClass(killerid) != CLASS_LAW)
{
      switch(ReturnPlayerClass(playerid)) //Get the class of the victim.
        {
            case CLASS_CIVILIAN:
            {
                format(TinyString, sizeof(TinyString), "Murder - %s (%d)", ReturnPlayerName(playerid), playerid);
                GivePlayerWantedLevel(killerid, MURDER, TinyString);    
            }

            case CLASS_LAW:
            {
                format(MediumString, sizeof(MediumString), "Law Enforcement Officer Murder - %s (%d)", ReturnPlayerName(playerid), playerid);
                GivePlayerWantedLevel(killerid, LEO_MURDER, MediumString);  
            }
        }
}

Try
Just a clarification. if ReturnPlayerClass(killerid) is not a class_law, then why you are using class_law in switch and giving the killerid the wanted level?


Quote:
if i'm a LEO and i kill a civilian/another LEO i'll still get wanted level
it should be
pawn Code:
if(ReturnPlayerClass(killerid) != ReturnPlayerClass(playerid))
So, that the killerid won't get wanted level if the player is his team.
__________________
Hey guys,
We've just started up our own hosting company and we are offering cheap game hosting. Our SAMP servers start at only $0.50 cents for 32 slots per month, or $1.50 for 64. We have ONE FREE spot left for a first month free subscription for any game host of your choice. We host most many major games such as SAMP, Call of Duty, 7 Days to Die, Minecraft, CounterStrike, ARK: Survival Evolved, and many more!

Cheapest hosting company official site : http://main-hosts.com/

Cheap Hosting Company is looking for an experience staff.

Sign up to our forums and Control Panel and order one of our cheap game servers. First to sign up will receive a free SA:MP server! Join on discord https://discord.gg/J82JgQJ for more information!
SiaReyes is offline   Reply With Quote
Old 16/08/2019, 03:45 PM   #7
GTLS
High-roller
 
GTLS's Avatar
 
Join Date: Aug 2014
Location: India
Posts: 1,019
Reputation: 115
Default Re: Doubt

Quote:
Originally Posted by SiaReyes View Post
Just a clarification. if ReturnPlayerClass(killerid) is not a class_law, then why you are using class_law in switch and giving the killerid the wanted level?



it should be
pawn Code:
if(ReturnPlayerClass(killerid) != ReturnPlayerClass(playerid))
So, that the killerid won't get wanted level if the player is his team.
Because thats not what he wants. He wants that if a cop kills someone, he should not get a wanted level but if a civilian kills another civilian, he gets murder charges and if he kills a LEO, he gets Murder of LEO charge.

if ReturnPlayerClass(killerid) returns CLASS_LAW, means, if the killer is LEO, he mustn't receive any wanted level. Inside switch he is using ReturnPlayerClass(playerid) means the person who died. If the person who died was a Civilian, the killer gets murder charge and if person who died was LEO, killer gets Murder of LEO charge.
__________________

I don't help for rep. I help cuz I was helped in the past.


Retired from SAMP Scene. Might open SAMP Forums once in a while.

Some treats for ya. Click em
Basic House System
Simple Speedo
Base Login/Register Script

GTLS is offline   Reply With Quote
Old 16/08/2019, 04:08 PM   #8
SiaReyes
Huge Clucker
 
SiaReyes's Avatar
 
Join Date: Mar 2019
Location: Coordinates X,Y,Z
Posts: 265
Reputation: 19
Default Re: Doubt

Quote:
Originally Posted by GTLS View Post
Because thats not what he wants. He wants that if a cop kills someone, he should not get a wanted level but if a civilian kills another civilian, he gets murder charges and if he kills a LEO, he gets Murder of LEO charge.

if ReturnPlayerClass(killerid) returns CLASS_LAW, means, if the killer is LEO, he mustn't receive any wanted level. Inside switch he is using ReturnPlayerClass(playerid) means the person who died. If the person who died was a Civilian, the killer gets murder charge and if person who died was LEO, killer gets Murder of LEO charge.
oh, i got confused a bit! Let him try your code. Let's wait!

Thanks for explaining!
__________________
Hey guys,
We've just started up our own hosting company and we are offering cheap game hosting. Our SAMP servers start at only $0.50 cents for 32 slots per month, or $1.50 for 64. We have ONE FREE spot left for a first month free subscription for any game host of your choice. We host most many major games such as SAMP, Call of Duty, 7 Days to Die, Minecraft, CounterStrike, ARK: Survival Evolved, and many more!

Cheapest hosting company official site : http://main-hosts.com/

Cheap Hosting Company is looking for an experience staff.

Sign up to our forums and Control Panel and order one of our cheap game servers. First to sign up will receive a free SA:MP server! Join on discord https://discord.gg/J82JgQJ for more information!
SiaReyes is offline   Reply With Quote
Old 16/08/2019, 07:29 PM   #9
KeyOfKey
Huge Clucker
 
KeyOfKey's Avatar
 
Join Date: Apr 2019
Posts: 339
Reputation: 12
Default Re: Doubt

It works, thank you.
KeyOfKey is online now   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Doubt KeyOfKey Scripting Help 5 28/07/2019 01:21 PM
doubt (++rep) Shaheen Scripting Help 2 20/07/2017 08:46 PM
Doubt kyriakos587 Scripting Help 0 25/06/2015 07:46 PM
PHP doubt ricardo178 Everything and Nothing 10 13/06/2012 03:23 PM
a big doubt Skylar Grey General 11 30/05/2012 02:30 AM


All times are GMT. The time now is 12:30 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.