#1

Hi again, what's going on?...

There's no errors/warrings but after i connecting to server i got Random Colors... i think its not work..
PHP код:
stock SetPlayerColors(playeridlevel)
{
  if(
GetPlayerWantedLevel(playerid) >= 0)
  {
     
SetPlayerColor(playeridCOLOR_WHITE);
  }
  else if(
GetPlayerWantedLevel(playerid) >= && GetPlayerWantedLevel(playerid) <= 3)
  {
     
SetPlayerColor(playeridCOLOR_YELLOW);
  }
  else if(
GetPlayerWantedLevel(playerid) >= && GetPlayerWantedLevel(playerid) <= 10)
  {
     
SetPlayerColor(playeridCOLOR_ORANGE);
  }
  else if(
GetPlayerWantedLevel(playerid) >= 11 && GetPlayerWantedLevel(playerid) <= 50)
  {
     
SetPlayerColor(playeridCOLOR_DARKORANGE);
  }
  return 
1;

Reply
#2

As I know it should end with an else, not sure.
Reply
#3

You mean "function". There's no such thing as "a stock". It's not random, it's just flawed logic. Unless you have negative levels the color will always be white. Consider using a switch.

PHP код:
switch(GetPlayerWantedLevel(playerid))
{
    case 
0SetPlayerColor(playeridCOLOR_WHITE);
    case 
.. 3SetPlayerColor(playeridCOLOR_YELLOW);
    case 
.. 10SetPlayerColor(playeridCOLOR_ORANGE)
    default: 
SetPlayerColor(playeridCOLOR_DARKORANGE);

Reply
#4

Quote:
Originally Posted by Vince
Посмотреть сообщение
You mean "function". There's no such thing as "a stock". It's not random, it's just flawed logic. Unless you have negative levels the color will always be white. Consider using a switch.

PHP код:
switch(GetPlayerWantedLevel(playerid))
{
    case 
0SetPlayerColor(playeridCOLOR_WHITE);
    case 
.. 3SetPlayerColor(playeridCOLOR_YELLOW);
    case 
.. 10SetPlayerColor(playeridCOLOR_ORANGE)
    default: 
SetPlayerColor(playeridCOLOR_DARKORANGE);

Hello vince, i make it like this

and still not work...
PHP код:
stock SetPlayerColors(playeridlevel)
{
  switch(
GetPlayerWantedLevel(playerid))
{
    case 
0SetPlayerColor(playeridCOLOR_WHITE);
    case 
.. 3SetPlayerColor(playeridCOLOR_YELLOW);
    case 
.. 10SetPlayerColor(playeridCOLOR_ORANGE)
    default: 
SetPlayerColor(playeridCOLOR_DARKORANGE);
}
  return 
1;

Reply
#5

Quote:
Originally Posted by Man43
Посмотреть сообщение
Hello vince, i make it like this

and still not work...
PHP код:
stock SetPlayerColors(playeridlevel)
{
  switch(
GetPlayerWantedLevel(playerid))
{
    case 
0SetPlayerColor(playeridCOLOR_WHITE);
    case 
.. 3SetPlayerColor(playeridCOLOR_YELLOW);
    case 
.. 10SetPlayerColor(playeridCOLOR_ORANGE)
    default: 
SetPlayerColor(playeridCOLOR_DARKORANGE);
}
  return 
1;

Remove 'stock', also what are you trying to achieve? Do you want the color to update regarding his wanted level?
Reply
#6

its should be like this?

Код:
SetPlayerColors(playerid, level)
{
  switch(GetPlayerWantedLevel(playerid))
{
    case 0: SetPlayerColor(playerid, COLOR_WHITE);
    case 1 .. 3: SetPlayerColor(playerid, COLOR_YELLOW);
    case 4 .. 10: SetPlayerColor(playerid, COLOR_ORANGE)
    default: SetPlayerColor(playerid, COLOR_DARKORANGE);
}
  return 1;
}
Reply
#7

Yea, and call it somewhere, for example when the wanted level updates use

SetPlayerColors(playerid, level);

What is that level actually? I don't see it being used?
Reply
#8

i got warring

Код:
warning 203: symbol is never used: "SetPlayerColors"
Reply
#9

SetPlayerColor
Reply
#10

Quote:
Originally Posted by Man43
Посмотреть сообщение
its should be like this?

Код:
SetPlayerColors(playerid, level)
{
  switch(GetPlayerWantedLevel(playerid))
{
    case 0: SetPlayerColor(playerid, COLOR_WHITE);
    case 1 .. 3: SetPlayerColor(playerid, COLOR_YELLOW);
    case 4 .. 10: SetPlayerColor(playerid, COLOR_ORANGE)
    default: SetPlayerColor(playerid, COLOR_DARKORANGE);
}
  return 1;
}
You have level as argument but you dont use it, instead you use GetPlayerWantedLevel. My guess is that you dont set that wanted level in first place. Anyway try replacing GetPlayerWantedLevel(playerid) with level
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)