Class - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Class (
/showthread.php?tid=412641)
Class -
DerickClark - 02.02.2013
Код:
case ClassFireman: // Fire-Man class
{
format(missiontext, sizeof(missiontext), BusDriver_NoJobText); // Preset the missiontext
SetPlayerColor(playerid, FireMan); // Set the playercolor (chatcolor for the player and color on the map)
}
Код:
C:\Users\gamemodes\PPC_Trucking.pwn(630) : error 017: undefined symbol "ClassFireman"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Error.
Re: Class - T0pAz - 02.02.2013
It's because the variable is undefined in otherwords non-existant.
Re: Class -
DerickClark - 02.02.2013
is they a code like new something?
Re: Class -
iManakoss - 02.02.2013
Try This
Код:
new gTeam[MAX_PLAYERS];
new gPlayerClass[MAX_PLAYERS];
#define TEAM_FIREMEN 1
public OnGameModeInit ()
{
SetGameModeText ("Test")
AddPlayerClass(bla bla)
return 1;
}
public OnPlayerRequestClassplayerid, classid)
{
gPlayerClass[playerid] = classid;
gTeam[playerid] = classid;
switch (classid) {
case 0:
{
format(missiontext, sizeof(missiontext), BusDriver_NoJobText); // Preset the missiontext
gTeam[playerid] = TEAM_FIREMEN;
GameTextForPlayer(playerid, "~r~ Firemen", 5500, 5);
SetPlayerColor(playerid, COLOR_RED);
}
}
if(classid == 0)
{
SetPlayerPos(playerid, 2527.1042,-1664.5869,15.1666);
SetPlayerFacingAngle(playerid,180);
SetPlayerCameraPos(playerid,2526.9868,-1666.8330,15.1683);
SetPlayerCameraLookAt(playerid,2527.1042,-1664.5869,15.1666);
}
return 1;
}
So when someone joins, and if he select Firemen, then this should work. (you must add the string)
Re: Class -
SuperViper - 02.02.2013
Also, if you do define the variable, it needs to be a part of the pre-processor also known as
#define. You can't use non-constant values in a case statement. Example:
This is fine:
This is wrong: