CMD:changeteam(playerid, params[]) { SetPlayerTeamFromClass(playerid, classid); return 1; }
forward SetPlayerTeamFromClass(playerid, classid); public OnPlayerRequestClass(playerid, classid) { SetPlayerTeamFromClass(playerid, classid); return 1; } public SetPlayerTeamFromClass(playerid, classid) { if(classid == 0 || classid == 1 || classid == 2 || classid == 3) { gTeam[playerid] = COPS; GameTextForPlayer(playerid,"~b~COPS",3000,5); SetPlayerPos(playerid,1975.2399,-1220.0157,25.0779); SetPlayerCameraPos(playerid,1969.5686,-1224.0016,24.9909); SetPlayerCameraLookAt(playerid,1975.2399,-1220.0157,25.0779); SetPlayerFacingAngle(playerid,122.4500); SetPlayerColor(playerid,0xA000FFFF); } else if(classid == 4 || classid == 5 || classid == 6 || classid == 7) { gTeam[playerid] = ROBBERS; GameTextForPlayer(playerid,"~r~ROBBERS",3000,5); SetPlayerPos(playerid,2500.6060,-1672.1453,13.3512); SetPlayerCameraPos(playerid,2507.0615,-1674.3574,13.3732); SetPlayerCameraLookAt(playerid,2500.6060,-1672.1453,13.3512); SetPlayerFacingAngle(playerid,252.4717); SetPlayerColor(playerid,0x55FF00FF); } }
error 017: undefined symbol "classid"
CMD:changeteam(playerid, params[]) { SetPlayerTeamFromClass(playerid, classid); return 1; }
public SetPlayerTeamFromClass(playerid, classid) //classid is your parameter
CMD:changeteam(playerid, params[])
{
SetPlayerTeamFromClass(playerid, classid);
return 1;
}
CMD:changeteam(playerid, params[])
{
SetPlayerTeamFromClass(playerid, 1); //For example "1"
return 1;
}
public SetPlayerTeamFromClass(playerid, classid) //classid will be "1"
{
if(classid == 0 || classid == 1 || classid == 2 || classid == 3)
{
gTeam[playerid] = COPS;
GameTextForPlayer(playerid,"~b~COPS",3000,5);
SetPlayerPos(playerid,1975.2399,-1220.0157,25.0779);
SetPlayerCameraPos(playerid,1969.5686,-1224.0016,24.9909);
SetPlayerCameraLookAt(playerid,1975.2399,-1220.0157,25.0779);
SetPlayerFacingAngle(playerid,122.4500);
SetPlayerColor(playerid,0xA000FFFF);
}
else if(classid == 4 || classid == 5 || classid == 6 || classid == 7)
{
gTeam[playerid] = ROBBERS;
GameTextForPlayer(playerid,"~r~ROBBERS",3000,5);
SetPlayerPos(playerid,2500.6060,-1672.1453,13.3512);
SetPlayerCameraPos(playerid,2507.0615,-1674.3574,13.3732);
SetPlayerCameraLookAt(playerid,2500.6060,-1672.1453,13.3512);
SetPlayerFacingAngle(playerid,252.4717);
SetPlayerColor(playerid,0x55FF00FF);
}
}
if(classid == 0 || classid == 1 || classid == 2 || classid == 3)
Hello,RetroEX your public function has a parameter, in which it will pass a value to be performed.
PHP код:
PHP код:
PHP код:
As you called your function in the command, and put "1" as the class id, then the classid of this function will assume the value of 1, and will execute every body of the function. PHP код:
PHP код:
|