Help with a TeamDM script
#1

I get this error (124) : error 017: undefined symbol "SetPlayerToTeamColor"

Here is my script. Followed the tutorial on SA-MP Wiki so don't actually know what I did wrong :S






// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT

#include <a_samp>
#if defined FILTERSCRIPT
#include <streamer>
#include <sscanf2>
#define TEAM_LSPD 1
#define TEAM_SOA 2
#define TEAM_LSPD_COLOR 0x00FF00AA // Bright Green (in RGBA format)
#define TEAM_SOA_COLOR 0xFF00FFAA // Bright Purple
new gTeam[MAX_PLAYERS]; //Global array (Stores data to read and write)
SetPlayerTeamFromClass(playerid, classid)

{
if (classid == 0)
{
gTeam[playerid] = TEAM_LSPD;
}
else
{
gTeam[playerid] = TEAM_SOA;
}
}


SetPlayerToTeamColor(playerid)
{
if (gTeam[playerid] == TEAM_LSPD)
{
SetPlayerColor(playerid, TEAM_LSPD_COLOR);
}
else if (gTeam[playerid] == TEAM_SOA)
{
SetPlayerColor(playerid, TEAM_SOA_COLOR);
}
}


public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Jimmy Karlsson");
print("--------------------------------------\n");
return 1;
}

public OnFilterScriptExit()
{
return 1;
}

#else

main()
{
print("\n----------------------------------");
print(" JimmysDeathmatch");
print("----------------------------------\n");
}

#endif

public OnGameModeInit()
{
//Hдr lдgger man till nya skins.
// Don't use these lines if it's a filterscript
//polisen
AddStaticVehicle(597,1557.6084,-1607.4335,13.1503,3.6478,0,1);
//Sons of anarchy
AddStaticVehicle(463,694.8014,-474.0371,15.8537,90.5883,25,1); // soa 1
AddStaticVehicle(463,694.6365,-472.5578,15.8562,91.6353,32,1); // soa 2
AddStaticVehicle(463,694.5961,-470.9783,15.8557,88.3544,122,1); // soa 3
AddStaticVehicle(586,694.7456,-469.3488,15.8561,90.8062,10,1); // soa 4
AddStaticVehicle(586,694.7992,-467.5677,15.8553,87.6643,25,1); // soa 5
SetGameModeText("JimmysDeathmatch");
//SOA
AddPlayerClass(247, 1545.7916,-1675.6432,13.5611,92.1874,0,0,0,0,0,0);
AddPlayerClass(248,1545.7916,-1675.6432,13.5611,92.1874,0,0,0,0,0,0);
//LSPD
AddPlayerClass(280, 1545.7916,-1675.6432,13.5611,92.1874,0,0,0,0,0,0);
AddPlayerClass(281,1545.7916,-1675.6432,13.5611,92.1874,0,0,0,0,0,0);


return 1;
}

public OnGameModeExit()
{
return 1;
}
//Hдr har jag gjt sе att positionen дr vid polisstation
//Camerapositionen tittar pе skinnens
//Cameralookat tittar pе skinnens
public OnPlayerRequestClass(playerid, classid)
{

GivePlayerMoney(playerid, 15000); //han fеr 15000kr nдr han spawnar
SetPlayerPos(playerid, 1483.5361,-1713.5564,14.0469);
SetPlayerFacingAngle(playerid, 181.8816);
SetPlayerCameraPos(playerid, 1483.4851,-1704.9474,14.0469);
SetPlayerCameraLookAt(playerid, 1483.5361,-1713.5564,14.0469);
return 1;
}
//Allt detta sker nдr nеgon connectar
public OnPlayerConnect(playerid)
{
new string[256];
new playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,playername,sizeof(playernam e));//denna koden sдger till scriptet att ta personen som connectars player name =)
format(string, sizeof(string), "Welcome to the server %s fore tutorials and stuff visit http://random.com",playername);
SendClientMessage(playerid,0xAA3333AA,string); //Stringen gцr sе det i stringen цver
return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
return 1;
}

public OnPlayerSpawn(playerid)
{
SetPlayerToTeamColor(playerid);
return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
SendClientMessage(killerid,0xAA3333AA,"You murdered a man, and also stole his wallet with 500$ in it, hope no one saw you!");//Om du mцrdar nеgon fеr du detta meddelandet
GivePlayerMoney(killerid, 500); //om man mцrdar nеgon fеr man 500$ (du rеnar han RP int ekommit sе lеngt дn )
SendClientMessage(playerid,0xAA3333AA,"You were murdered and robbed for 500$, watch out next time!"); //om du blir mцrdad fеr du detta meddelandet
GivePlayerMoney(playerid, -500);//om man dцr fцrlorar man 600
return 1;
}

public OnVehicleSpawn(vehicleid)
{
return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
return 1;
}

public OnPlayerText(playerid, text[])
{
return 1;
}
//Hдr gцr jag kommands man kan anvдnda i spelet
public OnPlayerCommandText(playerid, cmdtext[])
{

if (strcmp("/kill", cmdtext, true, 10) == 0)
{
SetPlayerHealth(playerid, 0);
return 1;
}
if (strcmp("/buymp5", cmdtext, true, 10) == 0)
{
GivePlayerWeapon(playerid, 29,200);
GivePlayerMoney(playerid, -15000); //om du skriver /buymp5 sе "kцper" du en mp5 med 200 skott fцr 15000
return 1;
}
if (strcmp("/teleportspawn", cmdtext, true, 10) == 0)
{
SetPlayerPos(playerid, 1545.3984,-1675.6747,13.5603); //X, Y, Z
return 1;
}
if (strcmp("/helpme", cmdtext, true, 10) == 0)
{
SendClientMessage(playerid,0xAA3333AA,"For all the commands/jobs/location etc go to http://random.com");
return 1;
}
if (strcmp("/teleport1", cmdtext, true, 10) == 0)
{
SetPlayerPos(playerid, 2442.7378,-1279.5771,24.0000); //X, Y, Z
return 1;
}
//denna koden under gцr sе att jag kan spawna en bil, lite mera kompliserat
if(strcmp("/admincar", cmdtext, true, 5) == 0){
new Float, Float:y, Float:z, Float:az;
GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid, az);
CreateVehicle(429, x+5, y+5, z, az, -1, -1, 180);
return 1;
}
return 0;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
return 1;
}

public OnRconCommand(cmd[])
{
return 1;
}

public OnPlayerRequestSpawn(playerid)
{
return 1;
}

public OnObjectMoved(objectid)
{
return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
return 1;
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
return 1;
}

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
return 1;
}

public OnPlayerExitedMenu(playerid)
{
return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
return 1;
}

public OnPlayerUpdate(playerid)
{
return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
return 1;
}
Reply
#2

There was a lot more wrong with that code than that error,
pawn Код:
#include <a_samp>
#include <streamer>
#include <sscanf2>
#define TEAM_LSPD 1
#define TEAM_SOA 2
#define TEAM_LSPD_COLOR 0x00FF00AA // Bright Green (in RGBA format)
#define TEAM_SOA_COLOR 0xFF00FFAA // Bright Purple
new gTeam[MAX_PLAYERS]; //Global array (Stores data to read and write)


main()
{
print("\n----------------------------------");
print(" JimmysDeathmatch");
print("----------------------------------\n");
}


public OnGameModeInit()
{
//Hдr lдgger man till nya skins.
// Don't use these lines if it's a filterscript
//polisen
AddStaticVehicle(597,1557.6084,-1607.4335,13.1503,3.6478,0,1);
//Sons of anarchy
AddStaticVehicle(463,694.8014,-474.0371,15.8537,90.5883,25,1); // soa 1
AddStaticVehicle(463,694.6365,-472.5578,15.8562,91.6353,32,1); // soa 2
AddStaticVehicle(463,694.5961,-470.9783,15.8557,88.3544,122,1); // soa 3
AddStaticVehicle(586,694.7456,-469.3488,15.8561,90.8062,10,1); // soa 4
AddStaticVehicle(586,694.7992,-467.5677,15.8553,87.6643,25,1); // soa 5
SetGameModeText("JimmysDeathmatch");
//SOA
AddPlayerClass(247, 1545.7916,-1675.6432,13.5611,92.1874,0,0,0,0,0,0);
AddPlayerClass(248,1545.7916,-1675.6432,13.5611,92.1874,0,0,0,0,0,0);
//LSPD
AddPlayerClass(280, 1545.7916,-1675.6432,13.5611,92.1874,0,0,0,0,0,0);
AddPlayerClass(281,1545.7916,-1675.6432,13.5611,92.1874,0,0,0,0,0,0);


return 1;
}

public OnGameModeExit()
{
return 1;
}
//Hдr har jag gjt sе att positionen дr vid polisstation
//Camerapositionen tittar pе skinnens
//Cameralookat tittar pе skinnens
public OnPlayerRequestClass(playerid, classid)
{

GivePlayerMoney(playerid, 15000); //han fеr 15000kr nдr han spawnar
SetPlayerPos(playerid, 1483.5361,-1713.5564,14.0469);
SetPlayerFacingAngle(playerid, 181.8816);
SetPlayerCameraPos(playerid, 1483.4851,-1704.9474,14.0469);
SetPlayerCameraLookAt(playerid, 1483.5361,-1713.5564,14.0469);
SetPlayerTeamFromClass(playerid, classid);
return 1;
}
//Allt detta sker nдr nеgon connectar
public OnPlayerConnect(playerid)
{
new string[256];
new playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,playername,sizeof(playername));//denna koden sдger till scriptet att ta personen som connectars player name =)
format(string, sizeof(string), "Welcome to the server %s fore tutorials and stuff visit http://random.com",playername);
SendClientMessage(playerid,0xAA3333AA,string); //Stringen gцr sе det i stringen цver
return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
return 1;
}

public OnPlayerSpawn(playerid)
{
SetPlayerToTeamColor(playerid);
return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
SendClientMessage(killerid,0xAA3333AA,"You murdered a man, and also stole his wallet with 500$ in it, hope no one saw you!");//Om du mцrdar nеgon fеr du detta meddelandet
GivePlayerMoney(killerid, 500); //om man mцrdar nеgon fеr man 500$ (du rеnar han RP int ekommit sе lеngt дn )
SendClientMessage(playerid,0xAA3333AA,"You were murdered and robbed for 500$, watch out next time!"); //om du blir mцrdad fеr du detta meddelandet
GivePlayerMoney(playerid, -500);//om man dцr fцrlorar man 600
return 1;
}

public OnVehicleSpawn(vehicleid)
{
return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
return 1;
}

public OnPlayerText(playerid, text[])
{
return 1;
}
//Hдr gцr jag kommands man kan anvдnda i spelet
public OnPlayerCommandText(playerid, cmdtext[])
{

if (strcmp("/kill", cmdtext, true, 10) == 0)
{
SetPlayerHealth(playerid, 0);
return 1;
}
if (strcmp("/buymp5", cmdtext, true, 10) == 0)
{
GivePlayerWeapon(playerid, 29,200);
GivePlayerMoney(playerid, -15000); //om du skriver /buymp5 sе "kцper" du en mp5 med 200 skott fцr 15000
return 1;
}
if (strcmp("/teleportspawn", cmdtext, true, 10) == 0)
{
SetPlayerPos(playerid, 1545.3984,-1675.6747,13.5603); //X, Y, Z
return 1;
}
if (strcmp("/helpme", cmdtext, true, 10) == 0)
{
SendClientMessage(playerid,0xAA3333AA,"For all the commands/jobs/location etc go to http://random.com");
return 1;
}
if (strcmp("/teleport1", cmdtext, true, 10) == 0)
{
SetPlayerPos(playerid, 2442.7378,-1279.5771,24.0000); //X, Y, Z
return 1;
}
//denna koden under gцr sе att jag kan spawna en bil, lite mera kompliserat
if(strcmp("/admincar", cmdtext, true, 5) == 0){
new Float:x, Float:y, Float:z, Float:az;
GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid, az);
CreateVehicle(429, x+5, y+5, z, az, -1, -1, 180);
return 1;
}
return 0;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
return 1;
}

public OnRconCommand(cmd[])
{
return 1;
}

public OnPlayerRequestSpawn(playerid)
{
return 1;
}

public OnObjectMoved(objectid)
{
return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
return 1;
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
return 1;
}

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
return 1;
}

public OnPlayerExitedMenu(playerid)
{
return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
return 1;
}

public OnPlayerUpdate(playerid)
{
return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
return 1;
}

SetPlayerToTeamColor(playerid)
{
    if (gTeam[playerid] == TEAM_LSPD)
    {
        SetPlayerColor(playerid, TEAM_LSPD_COLOR);
    }
    else if (gTeam[playerid] == TEAM_SOA)
    {
        SetPlayerColor(playerid, TEAM_SOA_COLOR);
    }
}
SetPlayerTeamFromClass(playerid, classid)
{
if (classid == 0)
{
gTeam[playerid] = TEAM_LSPD;
}
else
{
gTeam[playerid] = TEAM_SOA;
}
}
Use [pawn] tags to make your code look like that in the forums, BTW i never fixed the indentation

I'd also read some tutorials if i was you. Gamemodes can be hard to code.
Reply
#3

I'm reading and trying to learn.. But at the same time i'm trying to create something to. To learn a bit from that The sa-mp wiki must be shit then? since ive followed theirs? :P
Reply
#4

Its not shit its good for resources ect, but tutorials isn't its strong point. Look on here in the tutorials board, and also its a very good idea to look at the gamemodes that come with the server package and see how they do things. And its always a good idea to READ ME
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)