How would i do this?
#1

pawn Код:
SetPlayerTeamFromClass(playerid, classid)
{
    if (classid == 0)
    {
        gTeam[playerid] = TEAM_POLICESF;
    }
    else
    {
        gTeam[playerid] = TEAM_CROOKSF;
    }
    else
    {
        gTeam[playerid] = TEAM_MEDICSF;
    }
}
Код:
C:\Program Files\Rockstar Games\GTA San Andreas\sa-mp\gamemodes\gamemode.pwn(305) : error 029: invalid expression, assumed zero
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
I know else is used as a last resort or w/e, but how would i do this?
Reply
#2

pawn Код:
if(classid == 0) gTeam[playerid] = TEAM_POLICESF;
else if(classid == OTHER_CLASS_ID) gTeam[playerid] = TEAM_CROOKSF;
else gTeam[playerid] = TEAM_MEDICSF;
or even better:
pawn Код:
switch(classid)
{
  case 0: gTeam[playerid] = TEAM_POLICESF;
  case OTHER_CLASS_ID: gTeam[playerid] = TEAM_CROOKSF;
  default: gTeam[playerid] = TEAM_MEDICSF;
}
Reply
#3

Would that work properly?
Because before TEAM_CROOKSF
Didnt have, if(classid == w/e)
Reply
#4

OTHER_CLASS_ID was just an example, put your own class-ID.
Reply
#5

pawn Код:
C:\Program Files\Rockstar Games\GTA San Andreas\sa-mp\gamemodes\gamemode.pwn(305) : error 029: invalid expression, assumed zero
C:\Program Files\Rockstar Games\GTA San Andreas\sa-mp\gamemodes\gamemode.pwn(313) : error 017: undefined symbol "classid"
C:\Program Files\Rockstar Games\GTA San Andreas\sa-mp\gamemodes\gamemode.pwn(317) : error 017: undefined symbol "classid"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


3 Errors.
Wouldnt like this work because its only to set the players color

pawn Код:
if(GetPlayerTeam(playerid) == 1) SetPlayerColor(playerid, TEAM_POLICESF_COLOR);
else if(GetPlayerTeam(playerid) == 2) SetPlayerColor(playerid, TEAM_CROOKSF_COLOR);
else if(GetPlayerTeam(playerid) == 3) SetPlayerColor(playerid, TEAM_MEDICSF_COLOR);
Or

pawn Код:
if(GetPlayerTeam(playerid) == TEAM_POLICESF) SetPlayerColor(playerid, TEAM_POLICESF_COLOR);
else if(GetPlayerTeam(playerid) == TEAM_CROOKSF) SetPlayerColor(playerid, TEAM_CROOKSF_COLOR);
else if(GetPlayerTeam(playerid) == TEAM_MEDICSF) SetPlayerColor(playerid, TEAM_MEDICSF_COLOR);
Or something like that

EDIT: Wait ive been putting them in completly the wrong place, Hold on
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)