13.07.2009, 11:38
Hello, i'm new to scripting (started yesterday) and I have a problem. I'm trying to a make a strtok command and I keep getting this error when I compile.
#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
#define strtok
new gTeam[MAX_PLAYERS];
new Menu:teleportmenu;
new value;
new tmp;
new cmd;
// 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(" Blank Filterscript by your name here");
print("--------------------------------------\n");
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
#else
main()
{
print("\n----------------------------------");
print(" Blank Gamemode by your name here");
print("----------------------------------\n");
}
#endif
public OnGameModeInit()
{
// Don't use these lines if it's a filterscript
teleportmenu = CreateMenu("Teleportmenu", 2, 200.0, 100.0, 150.0, 150.0);
AddMenuItem(teleportmenu, 0, "LS");
AddMenuItem(teleportmenu, 0, "LS");
AddMenuItem(teleportmenu, 0, "SF");
AddMenuItem(teleportmenu, 0, "SF");
AddMenuItem(teleportmenu, 0, "LV");
AddMenuItem(teleportmenu, 0, "LV");
AddMenuItem(teleportmenu, 1, "Grove Street");
AddMenuItem(teleportmenu, 1, "Starfish Tower");
AddMenuItem(teleportmenu, 1, "Wheel Arch Angels");
AddMenuItem(teleportmenu, 1, "Jizzys");
AddMenuItem(teleportmenu, 1, "4 Dragons");
AddMenuItem(teleportmenu, 1, "Come-a-Lot");
SetGameModeText("Blank Script");
AddStaticVehicle(560,1567.9526,-1010.7532,23.6129,2.6959,-1,-1);
AddPlayerClass(0, 1576.2999,-1023.2874, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(102, 1576.2999,-1023.2874, 15.3746, 269.1425, 5, 0, 22, 100, 32, 50);
return 1;
}
public OnGameModeExit()
{
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
SetPlayerTeamFromClass(playerid, classid);
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)
{
return 1;
}
public OnPlayerConnect(playerid)
{
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
return 1;
}
public OnPlayerSpawn(playerid)
{
SetPlayerToTeamColor(playerid);
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
return 1;
}
public OnVehicleSpawn(vehicleid)
{
return 1;
}
public OnVehicleDeath(vehicleid, killerid)
{
return 1;
}
public OnPlayerText(playerid, text[])
{
return 1;
}
public OnPlayerPrivmsg(playerid, recieverid, text[])
{
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
tmp[128]
cmd = strtok(cmdtext, value);
if(strcmp(cmd, "/setgravity", true) == 0);
{
tmp = strtok(cmdtext, value);
return 1;
}
if(strcmp(cmdtext, "/teleport", true) == 0)
{
ShowMenuForPlayer(teleportmenu,playerid);
return 1;
}
return 0;
}
You have an Idea what could be the problem?
Sory for the long post I don't know how to make spoilers
#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
#define strtok
new gTeam[MAX_PLAYERS];
new Menu:teleportmenu;
new value;
new tmp;
new cmd;
// 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(" Blank Filterscript by your name here");
print("--------------------------------------\n");
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
#else
main()
{
print("\n----------------------------------");
print(" Blank Gamemode by your name here");
print("----------------------------------\n");
}
#endif
public OnGameModeInit()
{
// Don't use these lines if it's a filterscript
teleportmenu = CreateMenu("Teleportmenu", 2, 200.0, 100.0, 150.0, 150.0);
AddMenuItem(teleportmenu, 0, "LS");
AddMenuItem(teleportmenu, 0, "LS");
AddMenuItem(teleportmenu, 0, "SF");
AddMenuItem(teleportmenu, 0, "SF");
AddMenuItem(teleportmenu, 0, "LV");
AddMenuItem(teleportmenu, 0, "LV");
AddMenuItem(teleportmenu, 1, "Grove Street");
AddMenuItem(teleportmenu, 1, "Starfish Tower");
AddMenuItem(teleportmenu, 1, "Wheel Arch Angels");
AddMenuItem(teleportmenu, 1, "Jizzys");
AddMenuItem(teleportmenu, 1, "4 Dragons");
AddMenuItem(teleportmenu, 1, "Come-a-Lot");
SetGameModeText("Blank Script");
AddStaticVehicle(560,1567.9526,-1010.7532,23.6129,2.6959,-1,-1);
AddPlayerClass(0, 1576.2999,-1023.2874, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(102, 1576.2999,-1023.2874, 15.3746, 269.1425, 5, 0, 22, 100, 32, 50);
return 1;
}
public OnGameModeExit()
{
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
SetPlayerTeamFromClass(playerid, classid);
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)
{
return 1;
}
public OnPlayerConnect(playerid)
{
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
return 1;
}
public OnPlayerSpawn(playerid)
{
SetPlayerToTeamColor(playerid);
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
return 1;
}
public OnVehicleSpawn(vehicleid)
{
return 1;
}
public OnVehicleDeath(vehicleid, killerid)
{
return 1;
}
public OnPlayerText(playerid, text[])
{
return 1;
}
public OnPlayerPrivmsg(playerid, recieverid, text[])
{
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
tmp[128]
cmd = strtok(cmdtext, value);
if(strcmp(cmd, "/setgravity", true) == 0);
{
tmp = strtok(cmdtext, value);
return 1;
}
if(strcmp(cmdtext, "/teleport", true) == 0)
{
ShowMenuForPlayer(teleportmenu,playerid);
return 1;
}
return 0;
}
Quote:
C:\Program Files\GTA.San.Andreas\Server\gamemodes\new.pwn(53) : warning 217: loose indentation C:\Program Files\GTA.San.Andreas\Server\gamemodes\new.pwn(65) : warning 217: loose indentation C:\Program Files\GTA.San.Andreas\Server\gamemodes\new.pwn(80) : warning 217: loose indentation C:\Program Files\GTA.San.Andreas\Server\gamemodes\new.pwn(104 ) : warning 217: loose indentation C:\Program Files\GTA.San.Andreas\Server\gamemodes\new.pwn(134 ) : error 028: invalid subscript (not an array or too many subscripts): "tmp" C:\Program Files\GTA.San.Andreas\Server\gamemodes\new.pwn(134 ) : warning 215: expression has no effect C:\Program Files\GTA.San.Andreas\Server\gamemodes\new.pwn(134 ) : error 001: expected token: ";", but found "]" C:\Program Files\GTA.San.Andreas\Server\gamemodes\new.pwn(134 ) : error 029: invalid expression, assumed zero C:\Program Files\GTA.San.Andreas\Server\gamemodes\new.pwn(134 ) : fatal error 107: too many error messages on one line |
Sory for the long post I don't know how to make spoilers
![Embarrassed](images/smilies/redface.gif)