Wanted help!
#1

Hey guys, How can i know Someone's current wanted level?
I mean i wanted to make something like "if player's wanted level is 5" and he type /wanted it removes 2 stars from his current Wanted level stars?
Any idea how can i do this?
Reply
#2

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

Use those two functions, GetPlayerWantedLevel, then check if the player is level 5 and at /wanted SetPlayerWantedLevel to 3, easy.
Reply
#3

Can't get it working
pawn Код:
if(GetPlayerWantedLevel(playerid, 6)) *then  SetPlayerWantedLevel(playerid, 3);
        return 1;
    }
    return 0;
}

Код:
E:\PC_GTA.SanAndreas -(rip)-(ToeD)\PC_GTA.SanAndreas -(rip)-(ToeD)\GTA.San.Andreas\PAWN\gamemodes\CnR.pwn(2302) : warning 202: number of arguments does not match definition
E:\PC_GTA.SanAndreas -(rip)-(ToeD)\PC_GTA.SanAndreas -(rip)-(ToeD)\GTA.San.Andreas\PAWN\gamemodes\CnR.pwn(2302) : error 029: invalid expression, assumed zero
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
try'd this one too
pawn Код:
if(GetPlayerWantedLevel(playerid, 6)) return  SetPlayerWantedLevel(playerid, 3);
        return 1;
    }
    return 0;
}
Код:
E:\PC_GTA.SanAndreas -(rip)-(ToeD)\PC_GTA.SanAndreas -(rip)-(ToeD)\GTA.San.Andreas\PAWN\gamemodes\CnR.pwn(2302) : warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.
Reply
#4

You can either do what Firo said...
or just create an enum with "pWanted" (or whatever the name you want for it) as a variable...
Then if the COP /suspect's him just place this in the command:
pawn Код:
PlayerInfo[targetid][pWanted]++; //I hope you know what Enums are...Also, you need sscanf to make the "targetid"
Then create a command, where it has an "IF" statement checking his wanted level (PlayerInfo[playerid][pWanted] == something)

Hope this helps, chech wikipedia for enums and their explanations.
Reply
#5

pawn Код:
if( !strcmp(cmdtext, "/wanted") )
{
    //They typed /wanted.
   
    if( GetPlayerWantedLevel(playerid) == 5 )
    {
        //Player's wanted level is 5, set to 3.                
        SetPlayerWantedLevel(playerid, 3);
    }
    return 1;
}
or if you wanted it to work for all wanted levels, you could use something like:

pawn Код:
if( !strcmp(cmdtext, "/wanted") )
{
    //They typed /wanted.
                   
    //Get the player's current wanted level, so we can check what it is,
    //and also minus values from it to check stuff.
    new curWantedLevel = GetPlayerWantedLevel(playerid);
   
    if( curWantedLevel >= 0 )
    {
        //If the wanted level is more than 0, then:


        //If the players current wanted level - 2 is less than 0, then minus itself from itself to get 0.
        //If it is not less than 0, then -2 off it.
        curWantedLevel -= ( (curWantedLevel - 2) < 0 ) ? ( curWantedLevel ) : ( 2 );
       
        //Set player's wanted level to this level.
        SetPlayerWantedLevel(playerid, curWantedLevel);
    }
    return 1;
}
Reply
#6

What's wrong with this?
pawn Код:
command(bribe, playerid, params[])
{
    new id,str[128], money, name[MAX_PLAYER_NAME], name2[MAX_PLAYER_NAME];
    if(gTeam[playerid] == CIVILIANS)
    {
        if(isnull(params)) return SendClientMessage(playerid, ROJO, "Usage: /bribe <playerid>");
        GivePlayerMoney(id, money);
        GetPlayerName(playerid, name2, sizeof(name2));
        GetPlayerName(id, name, sizeof(name));
        format(str,sizeof(str), "Player %s has given you bribe of $%d!", name2, money);
        SendClientMessage(id, ROJO, str);
        format(str,sizeof(str), "You have given %s bribe of $%d!", name, money);
        SendClientMessage(playerid,ROJO, "Your wanted level has been decreased by 3 stars");
        SendClientMessage(playerid, ROJO, str);
        if(GetPlayerWantedLevel(playerid, 6)) return SetPlayerWantedLevel(playerid, 3);
        return 1;
    }
    return 0;
}
Sorry haven't scripted long time..

Код:
E:\PC_GTA.SanAndreas -(rip)-(ToeD)\PC_GTA.SanAndreas -(rip)-(ToeD)\GTA.San.Andreas\PAWN\gamemodes\CnR.pwn(2301) : warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.
Reply
#7

Quote:
Originally Posted by Rudy_
Посмотреть сообщение
What's wrong with this?
pawn Код:
command(bribe, playerid, params[])
{
    new id,str[128], money, name[MAX_PLAYER_NAME], name2[MAX_PLAYER_NAME];
    if(gTeam[playerid] == CIVILIANS)
    {
        if(isnull(params)) return SendClientMessage(playerid, ROJO, "Usage: /bribe <playerid>");
        GivePlayerMoney(id, money);
        GetPlayerName(playerid, name2, sizeof(name2));
        GetPlayerName(id, name, sizeof(name));
        format(str,sizeof(str), "Player %s has given you bribe of $%d!", name2, money);
        SendClientMessage(id, ROJO, str);
        format(str,sizeof(str), "You have given %s bribe of $%d!", name, money);
        SendClientMessage(playerid,ROJO, "Your wanted level has been decreased by 3 stars");
        SendClientMessage(playerid, ROJO, str);
        if(GetPlayerWantedLevel(playerid, 6)) return SetPlayerWantedLevel(playerid, 3);
        return 1;
    }
    return 0;
}
Sorry haven't scripted long time..

Код:
E:\PC_GTA.SanAndreas -(rip)-(ToeD)\PC_GTA.SanAndreas -(rip)-(ToeD)\GTA.San.Andreas\PAWN\gamemodes\CnR.pwn(2301) : warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.
pawn Код:
if(GetPlayerWantedLevel(playerid, 6)) return SetPlayerWantedLevel(playerid, 3);
GetPlayerWantedLevel only takes in one argument - the player's id. It then returns the player's current wanted level, from their ID.

Here you're trying to use two arguments, when it is only defined as having one argument. Using:

pawn Код:
if(GetPlayerWantedLevel(playerid) == 6) return SetPlayerWantedLevel(playerid, 3); //This is what I assume you want
Should fix it.
Reply
#8

ok got it, so this will work fine right?
Got no errors
pawn Код:
if(GetPlayerWantedLevel(playerid) == 6) return SetPlayerWantedLevel(playerid, 3);
        else if(GetPlayerWantedLevel(playerid) == 5) return SetPlayerWantedLevel(playerid, 2);
        else if(GetPlayerWantedLevel(playerid) == 4) return SetPlayerWantedLevel(playerid, 1);
        else if(GetPlayerWantedLevel(playerid) == 3 && 2 && 1) return SetPlayerWantedLevel(playerid, 0);
        else if(GetPlayerWantedLevel(playerid) == 0) return SendClientMessage(playerid, ROJO, "You cannot Bribe when Not Wanted");
        else if(GetPlayerWantedLevel(playerid) == 0) return SendClientMessage(playerid, ROJO, "You are not Wanted");
        return 1;
    }
    return 0;
}
Ty
Reply
#9

Quote:
Originally Posted by Rudy_
Посмотреть сообщение
ok got it, so this will work fine right?
Got no errors
pawn Код:
if(GetPlayerWantedLevel(playerid) == 6) return SetPlayerWantedLevel(playerid, 3);
        else if(GetPlayerWantedLevel(playerid) == 5) return SetPlayerWantedLevel(playerid, 2);
        else if(GetPlayerWantedLevel(playerid) == 4) return SetPlayerWantedLevel(playerid, 1);
        else if(GetPlayerWantedLevel(playerid) == 3 && 2 && 1) return SetPlayerWantedLevel(playerid, 0);
        else if(GetPlayerWantedLevel(playerid) == 0) return SendClientMessage(playerid, ROJO, "You cannot Bribe when Not Wanted");
        else if(GetPlayerWantedLevel(playerid) == 0) return SendClientMessage(playerid, ROJO, "You are not Wanted");
        return 1;
    }
    return 0;
}
Ty
Check it out, tell us if it's working as well.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)