No idea where i have gone wrong -
Andy_P - 01.07.2009
i am a complete noob to scripting and i have tried to solve it by going on the chat (irc?) but no one wanted to talk to me
i was following this to try and teach myself how to script
https://sampwiki.blast.hk/wiki/PAWN_tutorial
but when i reched the end and tried to complile it i failed. it came up with this
Код:
C:\Program Files (x86)\Rockstar Games\GTA San Andreas\samp\gamemodes\ANDY.pwn(57) : error 017: undefined symbol "SetPlayerTeamFromClass"
C:\Program Files (x86)\Rockstar Games\GTA San Andreas\samp\gamemodes\ANDY.pwn(68) : warning 217: loose indentation
C:\Program Files (x86)\Rockstar Games\GTA San Andreas\samp\gamemodes\ANDY.pwn(76) : error 017: undefined symbol "SetPlayerToTeamColor"
C:\Program Files (x86)\Rockstar Games\GTA San Andreas\samp\gamemodes\ANDY.pwn(87) : warning 217: loose indentation
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
2 Errors.
so i obviously misread it and went through it again but i not sure what i done wrong.
so here is the script i made
Код:
#include <a_samp>
#define TEAM_GROVE 1
#define TEAM_BALLA 2
#define TEAM_GROVE_COLOR 0x00FF00AA // Bright Green (in RGBA format)
#define TEAM_BALLA_COLOR 0xFF00FFAA // Bright Purple
new gTeam[MAX_PLAYERS];
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Andy's test server");
print("--------------------------------------\n");
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
#else
main()
{
print("\n----------------------------------");
print(" Andy's test server");
print("----------------------------------\n");
}
#endif
public OnGameModeInit()
{
// Don't use these lines if it's a filterscript
SetGameModeText("Andy Test");
AddPlayerClass(0, 2162.6753,1866.7643,248.2952,146.9800, 38, 100000, 37, 100, 46, 0);
AddPlayerClass(102, 1958.3783, 1343.1572, 15.3746, 269.1425, 5, 0, 22, 100, 32, 50);
// car
AddStaticVehicle(411, 2040.2279, 1344.4127, 10.6719, 3.5436, 126, 54);
return 1;
}
public OnGameModeExit()
{
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
SetPlayerTeamFromClass(playerid, classid)
{
if (classid == 0)
{
gTeam[playerid] = TEAM_GROVE;
}
else
{
gTeam[playerid] = TEAM_BALLA;
}
}
SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
return 1;
}
public OnPlayerRequestSpawn(playerid)
{
SetPlayerToTeamColor(playerid)
{
if (gTeam[playerid] == TEAM_GROVE)
{
SetPlayerColor(playerid, TEAM_GROVE_COLOR);
}
else if (gTeam[playerid] == TEAM_BALLA)
{
SetPlayerColor(playerid, TEAM_BALLA_COLOR);
}
}
return 1;
}
public OnPlayerConnect(playerid)
{
return 1;
}
Everything i have done on the code is in that part.
please help i have tried to help my self by looking at examples but the wikipedia ones tend to confuse me.
thanks
Re: No idea where i have gone wrong -
James_Alex - 01.07.2009
try this
pawn Код:
#include <a_samp>
#define TEAM_GROVE 1
#define TEAM_BALLA 2
#define TEAM_GROVE_COLOR 0x00FF00AA // Bright Green (in RGBA format)
#define TEAM_BALLA_COLOR 0xFF00FFAA // Bright Purple
new gTeam[MAX_PLAYERS];
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Andy's test server");
print("--------------------------------------\n");
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
main()
{
print("\n----------------------------------");
print(" Andy's test server");
print("----------------------------------\n");
}
public OnGameModeInit()
{
// Don't use these lines if it's a filterscript
SetGameModeText("Andy Test");
AddPlayerClass(0, 2162.6753,1866.7643,248.2952,146.9800, 38, 100000, 37, 100, 46, 0);
AddPlayerClass(102, 1958.3783, 1343.1572, 15.3746, 269.1425, 5, 0, 22, 100, 32, 50);
// car
AddStaticVehicle(411, 2040.2279, 1344.4127, 10.6719, 3.5436, 126, 54);
return 1;
}
public OnGameModeExit()
{
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
SetPlayerTeamFromClass(playerid, classid);
SetPlayerToTeamColor(playerid);
return 1;
}
SetPlayerTeamFromClass(playerid, classid)
{
if (classid == 0)
{
gTeam[playerid] = TEAM_GROVE;
}
else
{
gTeam[playerid] = TEAM_BALLA;
}
SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
return 1;
}
SetPlayerToTeamColor(playerid)
{
if (gTeam[playerid] == TEAM_GROVE)
{
SetPlayerColor(playerid, TEAM_GROVE_COLOR);
}
else if (gTeam[playerid] == TEAM_BALLA)
{
SetPlayerColor(playerid, TEAM_BALLA_COLOR);
}
return 1;
}
public OnPlayerConnect(playerid)
{
return 1;
}
Re: No idea where i have gone wrong -
Andy_P - 01.07.2009
Thankyou i am starting to understand scripting more now lol.
Thanks