How does these Stock functions works?
#1

Can i just add them in code end, like example i wanna make if player is lower than 3 stars wanted level then hes player icon color will be yellow then sould i do like:
pawn Код:
Stock WantedColor(playerid)
{
        if(GetPlayerWantedLevel(playerid) > 3)
        {
                SetPlayerColor(playerid,COLOR_YELLOW);
        }
        return 1;
}
Its seem like that wont work.
Reply
#2

That's because > is the sign for greater than, you want it for when he has less than 3 stars right? So then you need to use the less than symbol (<).

Then you would just call the stock when you want to change the persons color, when do you want it to happen, when he connects? When he spawns?
Reply
#3

I want it to happen if he has less than 3 stars, example he steals car he gets 1 star then i already want that hes name color to be yellow.
Reply
#4

Well when you give him a star, just run that function. For example:

pawn Код:
// Your callback where player steals a car
SetPlayerWantedLevel(playerid, 1);
WantedColor(playerid);
Reply
#5

then u will need to set a timer and call the function for every player from it, and dont forgot to fix the greater mistake
Reply
#6

Quote:
Originally Posted by Tony_Montana
Посмотреть сообщение
then u will need to set a timer and call the function for every player from it, and dont forgot to fix the greater mistake
Why? That seems like an epic waste of resources, he's setting the wanted level himself so why can't he just set the color when he sets the wanted level at the same time? There's no need for a timer!
Reply
#7

I got easier idea. If player steals an car then my code will set his wanted level 1 so heres my code:
pawn Код:
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
        if(PlayerCivilian == 1)
        {
            if(GetPlayerWantedLevel(playerid) == 0)
            {
                new string[50];
                format(string,sizeof(string),"~r~You are committing crime", playerid);
                GameTextForPlayer(playerid,string,3000,4);
                SendClientMessage(playerid,COLOR_RED,"[CRIME]: Car jacking, you are now wanted with this car.");
                SetPlayerWantedLevel(playerid,1);
                SetPVarInt(playerid,"Timer",SetTimerEx("WantedLevelDown",30000,1,"i",playerid));
            }
        }
    }

    return 1;
}
And i just can add this code here,
pawn Код:
SetPlayerColor(playerid,COLOR_YELLOW);
Sould work but my "PlayerCivilian" is with white color or i guess i just make another team as "PlayerCriminal" with yellow color and in that code i make him PlayerCivilian = 0; and PlayerCriminal = 1; so he gets player Criminal color too, not sure... :P
Reply
#8

That's exactly what I said to do, no reason for timers or functions.
Reply
#9

hmm.. Adding this
pawn Код:
SetPlayerColor(playerid,COLOR_YELLOW);
worked but when wanted level went back 0 then my player color kept still yellow. I think i still have to make timer for that color too.
Reply
#10

Quote:
Originally Posted by tuuker
Посмотреть сообщение
hmm.. Adding this
pawn Код:
SetPlayerColor(playerid,COLOR_YELLOW);
worked but when wanted level went back 0 then my player color kept still yellow. I think i still have to make timer for that color too.
Why? Just add another SetPlayerColor whereever your script is setting it back to 0?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)