C:\Users\Pгo Doce\Desktop\Mafia\gamemodes\mafia.pwn(383) : error 002: only a single statement (or expression) can follow each "case"
C:\Users\Pгo Doce\Desktop\Mafia\gamemodes\mafia.pwn(383 -- 384) : error 028: invalid subscript (not an array or too many subscripts): "GetPlayerScore"
C:\Users\Pгo Doce\Desktop\Mafia\gamemodes\mafia.pwn(383 -- 385) : error 001: expected token: "}", but found "case"
C:\Users\Pгo Doce\Desktop\Mafia\gamemodes\mafia.pwn(383 -- 385) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
4 Errors.
public OnPlayerRequestClass(playerid, classid)
{
switch(classid) {
case 0 .. 2: Gang[playerid] = grove;
case 3 .. 5: Gang[playerid] = ballas;
case 6 .. 8: Gang[playerid] = vagos;
case 9 .. 11: Gang[playerid] = aztecas;
if(GetPlayerScore(playerid) > 500)
{
case 12 .. 14: Gang[playerid] = cops;
}
}
SetPlayerPos(playerid,1984.4445,157.9501,55.9384);
SetPlayerCameraPos(playerid,1984.4445,160.9501,55.9384);
SetPlayerCameraLookAt(playerid,1984.4445,157.9501,55.9384);
SetPlayerFacingAngle(playerid,0.0);
return 1;
}
case 9 .. 11: Gang[playerid] = aztecas;
if(GetPlayerScore(playerid) > 500)
{
case 12 .. 14: Gang[playerid] = cops;
}
case 12 .. 14:
{
if(GetPlayerScore(playerid) > 500)
{
Gang[playerid] = cops;
}
}
PHP код:
https://sampwiki.blast.hk/wiki/Control_Structures#case You should try using braces ( { } ) more. Код:
case 12 .. 14: { if(GetPlayerScore(playerid) > 500) { Gang[playerid] = cops; } } |
Now that, is something I'd like to know as well. Somewhere between OnPlayerRequestClass, and OnPlayerRequestSpawn you have to return 0 somewhere to stop them spawning.
https://sampwiki.blast.hk/wiki/OnPlayerRequestClass https://sampwiki.blast.hk/wiki/OnPlayerRequestSpawn If someone could enlighten us as to this... it would be much appreciated. |
Currently they can, because the code runs through to the return 1 that's at the bottom.
|
public OnPlayerRequestClass(playerid, classid)
{
switch(classid)
{
case 0 .. 2: Gang[playerid] = grove;
case 3 .. 5: Gang[playerid] = ballas;
case 6 .. 8: Gang[playerid] = vagos;
case 9 .. 11: Gang[playerid] = aztecas;
case 12 .. 14:
if(GetPlayerScore(playerid) < 500)
{
Gang[playerid] = cops;
}
}
SetPlayerPos(playerid,1984.4445,157.9501,55.9384);
SetPlayerCameraPos(playerid,1984.4445,160.9501,55.9384);
SetPlayerCameraLookAt(playerid,1984.4445,157.9501,55.9384);
SetPlayerFacingAngle(playerid,0.0);
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
switch(classid)
{
case 0 .. 2: Gang[playerid] = grove;
case 3 .. 5: Gang[playerid] = ballas;
case 6 .. 8: Gang[playerid] = vagos;
case 9 .. 11: Gang[playerid] = aztecas;
case 12 .. 14:
{
if(GetPlayerScore(playerid) < 500)
{
Gang[playerid] = cops;
}
}
}
SetPlayerPos(playerid,1984.4445,157.9501,55.9384);
SetPlayerCameraPos(playerid,1984.4445,160.9501,55.9384);
SetPlayerCameraLookAt(playerid,1984.4445,157.9501,55.9384);
SetPlayerFacingAngle(playerid,0.0);
return 1;
}
public OnPlayerRequestSpawn(playerid)
{
if(Gang[playerid] = cops&&GetPlayerScore(playerid) < 500)
{
SendClientMessage(playerid, -1, "You cannot spawn.");
return 0;
}
return 1;
}
PHP код:
PHP код:
|
C:\Users\Pгo Doce\Desktop\Mafia\gamemodes\mafia.pwn(379) : warning 211: possibly unintended assignment
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
1 Warning.
Gang[playerid] == cops