Colors.
#1

Код:
forward WantedLevelColour(playerid);
public WantedLevelColour(playerid)
{
		switch(GetPlayerWantedLevel(playerid))
		{
			case 0: SetPlayerColor(playerid, COLOR_WHITE);
			case 1: SetPlayerColor(playerid, COLOR_PURPLE);
			default: SetPlayerColor(playerid, COLOR_RED);
		}

	return 1;
}
Could somebody tell me why this isn't working?

i've it all ways and it still doesn't work.
Reply
#2

.... give us more we'll help you more .
you're missing something

where is the stocks of SetPlayerWantedColor .. GetPlayerWanted... where r the IF conditions on your " OnPlayerUpdate "



Revise your Sctructors
PHP код:
EXAMPLE ....
new
    
5;
switch (
a)
{
    case 
1:
    {
        
// Won't be called
    
}
    case 
2:
    {
        
// Won't be called
    
}
    case 
5:
    {
        
// Will be called
    
}
    default:
    {
        
// Won't be called
    
}

i cant do much for you just with 3 randomly Lines...

Good luck
Reply
#3

Quote:
Originally Posted by MCZOFT
Посмотреть сообщение
.... give us more we'll help you more .
you're missing something

where is the stocks of SetPlayerWantedColor .. GetPlayerWanted... where r the IF conditions on your " OnPlayerUpdate "



Revise your Sctructors
PHP код:
EXAMPLE ....
new
    
5;
switch (
a)
{
    case 
1:
    {
        
// Won't be called
    
}
    case 
2:
    {
        
// Won't be called
    
}
    case 
5:
    {
        
// Will be called
    
}
    default:
    {
        
// Won't be called
    
}

i cant do much for you just with 3 randomly Lines...

Good luck
First of all: https://sampforum.blast.hk/showthread.php?tid=570635
Second: do you see that he uses SetPlayerColor and GetPlayerWantedLevel, which are the premade functions? Why would he need to make some custom ones?
Third: you copied the switch from SA-MP wiki lol.

Quote:
Originally Posted by CannonBolt
Посмотреть сообщение
Код:
forward WantedLevelColour(playerid);
public WantedLevelColour(playerid)
{
		switch(GetPlayerWantedLevel(playerid))
		{
			case 0: SetPlayerColor(playerid, COLOR_WHITE);
			case 1: SetPlayerColor(playerid, COLOR_PURPLE);
			default: SetPlayerColor(playerid, COLOR_RED);
		}

	return 1;
}
Could somebody tell me why this isn't working?

i've it all ways and it still doesn't work.
Where do you call WantedLevelColour? Do you have a timer? Nothing seems to be wrong with your code though...
Reply
#4

PHP код:
GoldenLion 
3 words for you

Learn Algorithms First.

Then talk to me .

surely it's copied example i didn't say i wrote it . so instead of trying to be a hero , solve his problem with the information given or Quit the forum "breow"
Reply
#5

Quote:
Originally Posted by MCZOFT
Посмотреть сообщение
PHP код:
GoldenLion 
3 words for you

Learn Algorithms First.

Then talk to me .

surely it's copied example i didn't say i wrote it . so instead of trying to be a hero , solve his problem with the information given or Quit the forum "breow"
I am trying to help him and stop complaining about my name, watch yourself instead of disrespecting others or just don't even reply if you don't like me. If you reply again, I won't reply to you. This is not a place to act childish.
Reply
#6

Quote:
Originally Posted by MCZOFT
Посмотреть сообщение
PHP код:
GoldenLion 
3 words for you

Learn Algorithms First.

Then talk to me .

surely it's copied example i didn't say i wrote it . so instead of trying to be a hero , solve his problem with the information given or Quit the forum "breow"
Dude, just leave the fucking Scripting Help section. You aren't helping anyone. In fact, you've lied to this guy.

@CannonBolt: Ignore everything MCZOFT said. Your code is correct, as GoldenLion said. Just answer GoldenLion's question.
Reply
#7

Thanks @Crayder.

1. Should i change it to a stock?
2. i place it onplayerspawn as "WantedLevelColour(playerid);"

even when i get stars my color doesn't seem to change.
Reply
#8

May I ask where you are calling this function?

Are you calling it under OnPlayerUpdate ? Or when they do a specific action?
Reply
#9

Quote:
Originally Posted by azzerking
Посмотреть сообщение
May I ask where you are calling this function?

Are you calling it under OnPlayerUpdate ? Or when they do a specific action?
Quote:
Originally Posted by CannonBolt
Посмотреть сообщение
2. i place it onplayerspawn as "WantedLevelColour(playerid);"

even when i get stars my color doesn't seem to change.
Putting this under OnPlayerUpdate is a bad idea.
Reply
#10

Quote:
Originally Posted by CannonBolt
Посмотреть сообщение
Thanks @Crayder.

1. Should i change it to a stock?
2. i place it onplayerspawn as "WantedLevelColour(playerid);"

even when i get stars my color doesn't seem to change.
There is your problem. If you are only calling it when the player spawns it will not change when the wanted level of that player changes.

You should hook SetPlayerWantedLevel and add this line to it. That will be the only time you ever need to call it! Do not call it anywhere else!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)