SA-MP Forums Archive
Need help! - Crime - Wanted Levels - 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: Need help! - Crime - Wanted Levels (/showthread.php?tid=426212)



Need help! - Crime - Wanted Levels - Uberanwar - 28.03.2013

Hi all, I have a CNR Server. I need help with crime - wanted levels. How to make if a civilian steals law enforcement vehicles they will get wanted levels and how to make if a civilian assaults/kill police they will get wanted levels?

Please tell me how to do it explain clearly one by one so I can understand.


Re: Need help! - Crime - Wanted Levels - Patrick - 28.03.2013

This will help you

https://sampwiki.blast.hk/wiki/SetPlayerWantedLevel
https://sampwiki.blast.hk/wiki/GetPlayerWantedLevel


Re: Need help! - Crime - Wanted Levels - Uberanwar - 28.03.2013

Quote:
Originally Posted by pds2012
Посмотреть сообщение
Thanks for the reply. I'm talking about how to make civilians get wanted levels if they steal law enforcement vehicles and assaulting/kill police or other civs.


Re: Need help! - Crime - Wanted Levels - Patrick - 28.03.2013

you can use OnPlayerStateChange or OnPlayerEnterVehicle and for the assaulting you can use OnPlayerTakeDamage


Re: Need help! - Crime - Wanted Levels - Uberanwar - 28.03.2013

Quote:
Originally Posted by pds2012
Посмотреть сообщение
you can use OnPlayerStateChange or OnPlayerEnterVehicle and for the assaulting you can use OnPlayerTakeDamage
Can you give me one example of the ''script''?


Re: Need help! - Crime - Wanted Levels - Patrick - 28.03.2013

here you go some quick examples just change the gTeam to your own team variable and stuff that you need to change in the code

Here You Go
pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
    if(issuerid != INVALID_PLAYER_ID && gTeam[playerid] == TEAM_CIVILIAN)
    {
        new
            string[128],
            name[24],
            pname[24]
        ;
        GetPlayerName(issuerid, name, sizeof(name));
        GetPlayerName(playerid, pname, sizeof(pname));
        //
        SetPlayerWantedLevel(playerid, GetPlayerWantedLevel(playerid)+2);
        format(string,sizeof(string),"[ASSAULT] %s[%d] is firing gun shots to %s[%d]",name,issuerid,pname,playerid);
        SendClientMessageToAll(-1,string);
    }
    return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER)
    {  
        new vehicleid = GetPlayerVehicleID(playerid);
        if(GetVehicleModel(vehicleid) == 416 && gTeam[playerid] == TEAM_CIVILIAN)
        {
        new
            string[128],
            pname[24]
        ;
            GetPlayerName(playerid, pname, sizeof(pname));
            SetPlayerWantedLevel(playerid, GetPlayerWantedLevel(playerid)+2);
            format(string,sizeof(string),"[GTA] %s[%d] has stolen a Ambulance. Police watch out!",pname);
            SendClientMessageToAll(-1,string);
       
        }
    }
    return 1;
}
PS i did not use OnPlayerEnterVehicle because OnPlayerStateChange is what people always use for CnR