What is wrong in that code
#1

what is wrong here because the script didn't work

PHP код:
else if(PlayerInfo[playerid][pMember] == TEAM_CIVILIAN)
    {
       if(
GetPlayerScore(playerid) < 15)
         {
        
GivePlayerGun(playerid33);//tec9
        
GivePlayerGun(playerid23);//deagle
        
}
        if(
GetPlayerScore(playerid) > 50000)
        
GivePlayerGun(playerid26);//sawn
        
GivePlayerGun(playerid32);//tec
    

Reply
#2

PHP код:
else if(PlayerInfo[playerid][pMember] == TEAM_CIVILIAN)
    {
       if(
GetPlayerScore(playerid) < 15)
         {
              
SetPlayerWeapon(playerid33);//tec9
              
SetPlayerWeapon(playerid23);//deagle
        
}
        if(
GetPlayerScore(playerid) > 50000)
              
SetPlayerWeapon(playerid26);//sawn
              
SetPlayerWeapon(playerid32);//tec
    

Reply
#3

Quote:
Originally Posted by Windows32
Посмотреть сообщение
PHP код:
else if(PlayerInfo[playerid][pMember] == TEAM_CIVILIAN)
    {
       if(
GetPlayerScore(playerid) < 15)
         {
              
SetPlayerWeapon(playerid33);//tec9
              
SetPlayerWeapon(playerid23);//deagle
        
}
        if(
GetPlayerScore(playerid) > 50000)
              
SetPlayerWeapon(playerid26);//sawn
              
SetPlayerWeapon(playerid32);//tec
    

SetPlayerWeapon ?

GivePlayerWeapon
Reply
#4

Quote:
Originally Posted by Viniborn
Посмотреть сообщение
SetPlayerWeapon ?

GivePlayerWeapon
Sorry that's what I meant.
Reply
#5

I'm surprised that compiles or works. if(GetPlayerScore(playerid) > 50000) has no brackets

pawn Код:
if(GetPlayerScore(playerid) > 50000)
              GivePlayerGun(playerid, 26);//sawn
              GivePlayerGun(playerid, 32);//tec
has to be

pawn Код:
if(GetPlayerScore(playerid) > 50000)
{
    GivePlayerGun(playerid, 26);//sawn
    GivePlayerGun(playerid, 32);//tec
}
and use GivePlayerWeapon to give a weapon to a player unless you've made a stock for GivePlayerGun
Reply
#6

when you dont put brackets after an if, that if will only affect the next line

Код:
if (a == 1)
    command1;
command2;
command 2 will allways be executed
if u make use of this, please use tabs accordingly

anyway i suggest to allways put brackets, even if there is only one command after the if, because it's confusing and it can cause problems when you want to add something to it and you dont remember to put the brackets after that.
especialy if your compiler outputs shows you 300 warnings about "loosing identication" allready
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)