[HELP] Whats wrong?
#1

I made a wanted level color script for my CnR but Im new at scripting, whats wrong here?
Код:
public OnPlayerUpdate(playerid)
{
	new wantedlevel;
 	wantedlevel = GetPlayerWantedLevel(playerid);
	if wantedlevel =< 2 SetPlayerColor(COLOR_LIGHTRED);
	if wantedlevel => 3 SetPlayerColor(COLOR_RED);
	return 1;
}
And I get those errors
Код:
C:\Counter-Strike 2D\SampSrv\gamemodes\CnRTest.pwn(222) : warning 211: possibly unintended assignment
C:\Counter-Strike 2D\SampSrv\gamemodes\CnRTest.pwn(222) : error 029: invalid expression, assumed zero
C:\Counter-Strike 2D\SampSrv\gamemodes\CnRTest.pwn(222) : warning 215: expression has no effect
C:\Counter-Strike 2D\SampSrv\gamemodes\CnRTest.pwn(222) : error 001: expected token: ";", but found "-identifier-"
C:\Counter-Strike 2D\SampSrv\gamemodes\CnRTest.pwn(222) : warning 202: number of arguments does not match definition
C:\Counter-Strike 2D\SampSrv\gamemodes\CnRTest.pwn(223) : warning 211: possibly unintended assignment
C:\Counter-Strike 2D\SampSrv\gamemodes\CnRTest.pwn(223) : error 029: invalid expression, assumed zero
C:\Counter-Strike 2D\SampSrv\gamemodes\CnRTest.pwn(223) : warning 215: expression has no effect
C:\Counter-Strike 2D\SampSrv\gamemodes\CnRTest.pwn(223) : error 001: expected token: ";", but found "-identifier-"
C:\Counter-Strike 2D\SampSrv\gamemodes\CnRTest.pwn(223) : warning 202: number of arguments does not match definition
C:\Counter-Strike 2D\SampSrv\gamemodes\CnRTest.pwn(223) : warning 204: symbol is assigned a value that is never used: "wantedlevel"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Please help
Reply
#2

Noone?
Reply
#3

pawn Код:
public OnPlayerUpdate(playerid)
{
    new wantedlevel;
    wantedlevel = GetPlayerWantedLevel(playerid);
    if(wantedlevel =< 2) SetPlayerColor(COLOR_LIGHTRED);
    if(wantedlevel => 3) SetPlayerColor(COLOR_RED);
    return 1;
}
Try it.
Reply
#4

It must be: >= and <=
Reply
#5

here is the right code
Код:
public OnPlayerUpdate(playerid)
{
    new wantedlevel;
    wantedlevel = GetPlayerWantedLevel(playerid);
    if(wantedlevel =< 2) 
    { 
    SetPlayerColor(COLOR_LIGHTRED);
    }
    else if(wantedlevel => 3)
    { 
    SetPlayerColor(COLOR_RED);
    }
    return 1;
}
Reply
#6

None worked
Reply
#7

Thats because both of them forgot to actually include an ID.

SetPlayerColor(Color) is what they did, so where is the actual PLAYER-SELECTION.

Just ex-change the
pawn Код:
SetPlayerColor(COLOR);
with:
pawn Код:
SetPlayerColor(playerid, COLOR);
and it should work fine.
Reply
#8

Quote:
Originally Posted by [NT
Extremo ]
Thats because both of them forgot to actually include an ID.

SetPlayerColor(Color) is what they did, so where is the actual PLAYER-SELECTION.

Just ex-change the
pawn Код:
SetPlayerColor(COLOR);
with:
pawn Код:
SetPlayerColor(playerid, COLOR);
and it should work fine.
and that

Quote:
Originally Posted by ¤Adas¤
It must be: >= and <=
Quote:
Originally Posted by [AC
Etch ]
here is the right code
Код:
public OnPlayerUpdate(playerid)
{
    new wantedlevel;
    wantedlevel = GetPlayerWantedLevel(playerid);
    if(wantedlevel =< 2) 
    { 
    SetPlayerColor(COLOR_LIGHTRED);
    }
    else if(wantedlevel => 3)
    { 
    SetPlayerColor(COLOR_RED);
    }
   return 1;
}
so still wrong

https://sampwiki.blast.hk/wiki/Scripting:tags#Operators
Reply
#9

Good one, didn't notice that. You can also memorize the order by actually thinking via the mathematical term. It is a < or > and under it is either a _ or a = so, first comes the above, then the below.

Like these:

or

(Credits to wikipedia & the makers for the pictures)
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)