SA-MP Forums Archive
Hello Im New Help me please? - 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: Hello Im New Help me please? (/showthread.php?tid=606539)



Hello Im New Help me please? - Recardo - 05.05.2016

Hello Guys i need help with How to i can

SetPlayerWanted(playerid, +1); with colour Yellow
SetPlayerWanted(playerid, +4); Color Orange
? Can you help me?

EDITED: Look Guys i mean when Player Have 4 stars
Код:
SetPlayerWantedLevel(playerid, GetPlayerWantedLevel(playerid)+4);
and 3stars too but yellow.


Re: Hello Im New Help me please? - RedRex - 05.05.2016

Код:
SetPlayerColor(playerid, COLOR_YELLOW); 
SetPlayerColor(playerid, COLOR_ORANGE);
_____________________________________
if i help you REP ME.


Re: Hello Im New Help me please? - Recardo - 05.05.2016

Can you give me Full Code? This Dosn't work!


Re: Hello Im New Help me please? - cdoubleoper - 05.05.2016

You have to define it.
Код:
#define name value
for example:
Код:
#define COLOR_YELLOW 0xFFFF00FF



Re: Hello Im New Help me please? - Recardo - 05.05.2016

ARE You Crazy? I KNOW IT ! I Mean How did player when HAVE 3 Stars Got YELLOW Color and when get 4 got Ornage.... Plesae Understand


Re: Hello Im New Help me please? - karoliko - 05.05.2016

Quote:
Originally Posted by Recardo
Посмотреть сообщение
ARE You Crazy? I KNOW IT ! I Mean How did player when HAVE 3 Stars Got YELLOW Color and when get 4 got Ornage.... Plesae Understand
You mean the color of the player?
SetPlayerColor(playerid, color);


Re: Hello Im New Help me please? - Dayrion - 05.05.2016

Quote:
Originally Posted by Recardo
Посмотреть сообщение
ARE You Crazy? I KNOW IT ! I Mean How did player when HAVE 3 Stars Got YELLOW Color and when get 4 got Ornage.... Plesae Understand
Firstly, you have to chill bro'. We are to help you, but we oblige.
So, you want when a player gets 4th stars, his name is orange?

Check this native function called OnPlayerUpdate(playerid)
PHP код:
public OnPlayerUpdate(playerid
This function return something every player's action. So it's usefull to check if the player have 0, 1, ..., 4 stars!
Let's make a condition :
PHP код:
#define COLOR_YELLOW 0xFFFF00FF
#define COLOR_ORANGE 0xff9900FF
public OnPlayerUpdate(playerid)
{
    if(
GetPlayerWantedLevel(playerid) > && GetPlayerWantedLevel(playerid) =< 3// Check if the player has more 0 wanted level AND (&&) if the players have less of 4 wanted level
    
{
        
SetPlayerColor(playeridCOLOR_YELLOW); // So.. We set the player's YELLOW
    
}
    if(
GetPlayerWantedLevel(playerid) > 3// Check again if the player has MORE 3 wanted levels
    
{
        
SetPlayerColor(playeridCOLOR_ORANGE); // Set the player's color in ORANGE
    
}
    return 
1// Return 1 to finish the function

I hope, I helped you. Also you may check the SA:MP's WIKI.


Re: Hello Im New Help me please? - KevinReinke - 05.05.2016

Quote:
Originally Posted by Dayrion
Посмотреть сообщение
...
That's one way to go about this; however, it is not that efficient. OnPlayerUpdate is called multiple times per second, and it's use isn't needed in this case. As the script knows when a player receives wanted level, the update of the player's color should be done at the same instance. The same way other related updates should be handled.


Re: Hello Im New Help me please? - Dayrion - 05.05.2016

Quote:
Originally Posted by KevinReinke
Посмотреть сообщение
That's one way to go about this; however, it is not that efficient. OnPlayerUpdate is called multiple times per second, and it's use isn't needed in this case. As the script knows when a player receives wanted level, the update of the player's color should be done at the same instance. The same way other related updates should be handled.
He is newbie and he needs to understand a very simple way to do this. He can also put this in his command without redefine SetPlayerWantedLevel(playerid);.
Anyway, you are right!


Re: Hello Im New Help me please? - KevinReinke - 05.05.2016

Quote:
Originally Posted by Dayrion
Посмотреть сообщение
...
With the code I posted, all he has to do is copy/paste it into his script before the native function is used anywhere. And continue to use SetPlayerWantedLevel. I also included comments. It couldn't be any simpler.