Skip to content
Bekijk in de app

Een betere weg om onze GTA community te volgen. Leer meer.

GTAGames.nl - De Nederlandse Grand Theft Auto Community!

Een volledig scherm app op het beginscherm inclusief notificaties, badges en meer.

Om deze app op je iPhone en iPad te installeren
  1. Druk op het icoon in Safari
  2. Scroll in het menu en druk op Zet op beginscherm.
  3. Druk op Voeg toe rechts bovenaan.
Om deze app op je Android toe te voegen
  1. Druk op het 3-punten menu (⋮) rechts bovenaan in de browser.
  2. Druk op Toevoegen aan beginscherm of Installeer app.
  3. Druk op Toevoegen om te bevestigen.

Team Script Probleem

Geplaatst:

Hallo allemaal, nadat ik een PAWNO tutorial op de SA:MP wiki gevonden had wilde ik wel eens een TDM maken. Dus ik ging vol goede hoop aan de slag. Maar, hoe kan het ook anders, bij het compilen kreeg ik een aantal errors. Ik hoop dat jullie weten wat er aan de hand is! :Y

Script:

#include <a_samp>
#include <core>
#include <float>
#include <datagram>
#include <file>
#include <string>
#include <time>

#define TEAM_ORANGE
#define TEAM_YELLOW

#define TEAM_ORANGE_COLOR 0xFF9900AA //orange color
#define TEAM_YELLOW_COLOR 0xFFFF00AA //yellow color

new gTeam[MAX_PLAYERS];

main()
{
print("\n----------------------------------");
print("  This is a blank GameModeScript");
print("----------------------------------\n");
}



public OnGameModeInit()
{
print("GameModeInit()");
SetGameModeText("Blank Script");
AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(57, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
SetPlayerTeamFromClass(playerid, classid);
}

public SetPlayerTeamFromClass(playerid, classid)
{
if (classid == 0)
{
	gTeam[playerid] = TEAM_ORANGE; // defines which team should be assigned
	}
	else
	{
		gTeam[playerid] = TEAM_YELLOW; //defines which team should be assigned
  }
}

public SetPlayerToTeamColor(playerid)
{
if (gTeam[playerid] == TEAM_ORANGE)
{
	SetPlayerColor(playerid, TEAM_ORANGE_COLOR);
}
else if (gTeam[playerid] == TEAM_YELLOW)
{
	SetPlayerColor(playerid, TEAM_YELLOW_COLOR);
}
}

public OnGameModeExit()
{
print("GameModeExit()");
return 1;
}

public OnPlayerConnect(playerid)
{
printf("OnPlayerConnect(%d)", playerid);
return 1;
}

public OnPlayerDisconnect(playerid)
{
printf("OnPlayerDisconnect(%d)", playerid);
return 1;
}

public OnPlayerSpawn(playerid)
{
printf("OnPlayerSpawn(%d)", playerid);
SetPlayerToTeamColor(playerid);
return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
printf("OnPlayerDeath(%d, %d, %d)", playerid, killerid, reason);
return 1;
}

public OnVehicleSpawn(vehicleid)
{
printf("OnVehicleSpawn(%d)", vehicleid);
return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
printf("OnVehicleDeath(%d, %d)", vehicleid, killerid);
return 1;
}

public OnPlayerText(playerid)
{
printf("OnPlayerText(%d)", playerid);
return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp(cmdtext, "/mycommand", true)==0)
{
	/* Do something here */
	return 1;
}
return 0;
}

public OnPlayerInfoChange(playerid)
{
printf("OnPlayerInfoChange(%d)");
return 1;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
printf("OnPlayerEnterVehicle(%d, %d, %d)", playerid, vehicleid, ispassenger);
return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
printf("OnPlayerExitVehicle(%d, %d)", playerid, vehicleid);
return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
printf("OnPlayerStateChange(%d, %d, %d)", playerid, newstate, oldstate);
return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
printf("OnPlayerEnterCheckpoint(%d)", playerid);
return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
printf("OnPlayerLeaveCheckpoint(%d)", playerid);
return 1;
}

Error:

C:\Documents and Settings\-Roy-\Bureaublad\server\gamemodes\commandtestfile.pwn(44) : error 029: invalid expression, assumed zero
C:\Documents and Settings\-Roy-\Bureaublad\server\gamemodes\commandtestfile.pwn(48) : error 029: invalid expression, assumed zero
C:\Documents and Settings\-Roy-\Bureaublad\server\gamemodes\commandtestfile.pwn(54) : error 029: invalid expression, assumed zero
C:\Documents and Settings\-Roy-\Bureaublad\server\gamemodes\commandtestfile.pwn(58) : error 029: invalid expression, assumed zero
Pawn compiler 3.0.3367			Copyright (c) 1997-2005, ITB CompuPhase


4 Errors.

Alvast bedankt!

Featured Replies

Geplaatst:
Hallo allemaal, nadat ik een PAWNO tutorial op de SA:MP wiki gevonden had wilde ik wel eens een TDM maken. Dus ik ging vol goede hoop aan de slag. Maar, hoe kan het ook anders, bij het compilen kreeg ik een aantal errors. Ik hoop dat jullie weten wat er aan de hand is! :Y

Script:

#include <a_samp>
#include <core>
#include <float>
#include <datagram>
#include <file>
#include <string>
#include <time>

#define TEAM_ORANGE
#define TEAM_YELLOW

#define TEAM_ORANGE_COLOR 0xFF9900AA //orange color
#define TEAM_YELLOW_COLOR 0xFFFF00AA //yellow color

new gTeam[MAX_PLAYERS];

main()
{
print("\n----------------------------------");
print("  This is a blank GameModeScript");
print("----------------------------------\n");
}



public OnGameModeInit()
{
print("GameModeInit()");
SetGameModeText("Blank Script");
AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(57, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
SetPlayerTeamFromClass(playerid, classid);
}

public SetPlayerTeamFromClass(playerid, classid)
{
if (classid == 0)
{
	gTeam[playerid] = TEAM_ORANGE; // defines which team should be assigned
	}
	else
	{
		gTeam[playerid] = TEAM_YELLOW; //defines which team should be assigned
  }
}

public SetPlayerToTeamColor(playerid)
{
if (gTeam[playerid] == TEAM_ORANGE)
{
	SetPlayerColor(playerid, TEAM_ORANGE_COLOR);
}
else if (gTeam[playerid] == TEAM_YELLOW)
{
	SetPlayerColor(playerid, TEAM_YELLOW_COLOR);
}
}

public OnGameModeExit()
{
print("GameModeExit()");
return 1;
}

public OnPlayerConnect(playerid)
{
printf("OnPlayerConnect(%d)", playerid);
return 1;
}

public OnPlayerDisconnect(playerid)
{
printf("OnPlayerDisconnect(%d)", playerid);
return 1;
}

public OnPlayerSpawn(playerid)
{
printf("OnPlayerSpawn(%d)", playerid);
SetPlayerToTeamColor(playerid);
return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
printf("OnPlayerDeath(%d, %d, %d)", playerid, killerid, reason);
return 1;
}

public OnVehicleSpawn(vehicleid)
{
printf("OnVehicleSpawn(%d)", vehicleid);
return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
printf("OnVehicleDeath(%d, %d)", vehicleid, killerid);
return 1;
}

public OnPlayerText(playerid)
{
printf("OnPlayerText(%d)", playerid);
return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp(cmdtext, "/mycommand", true)==0)
{
	/* Do something here */
	return 1;
}
return 0;
}

public OnPlayerInfoChange(playerid)
{
printf("OnPlayerInfoChange(%d)");
return 1;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
printf("OnPlayerEnterVehicle(%d, %d, %d)", playerid, vehicleid, ispassenger);
return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
printf("OnPlayerExitVehicle(%d, %d)", playerid, vehicleid);
return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
printf("OnPlayerStateChange(%d, %d, %d)", playerid, newstate, oldstate);
return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
printf("OnPlayerEnterCheckpoint(%d)", playerid);
return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
printf("OnPlayerLeaveCheckpoint(%d)", playerid);
return 1;
}

Error:

C:\Documents and Settings\-Roy-\Bureaublad\server\gamemodes\commandtestfile.pwn(44) : error 029: invalid expression, assumed zero
C:\Documents and Settings\-Roy-\Bureaublad\server\gamemodes\commandtestfile.pwn(48) : error 029: invalid expression, assumed zero
C:\Documents and Settings\-Roy-\Bureaublad\server\gamemodes\commandtestfile.pwn(54) : error 029: invalid expression, assumed zero
C:\Documents and Settings\-Roy-\Bureaublad\server\gamemodes\commandtestfile.pwn(58) : error 029: invalid expression, assumed zero
Pawn compiler 3.0.3367			Copyright (c) 1997-2005, ITB CompuPhase


4 Errors.

Alvast bedankt!

sorry voor de late reactie

maar je kan niet gTeam[playerid] een niet bestaande waarden toekennen

gTeam[playerid] = TEAM_ORANGE;

je hebt TEAM_ORANGE wel gereserveerd, maar er staat nog niks in dus kan je ook niks opvragen

dus van:

#define TEAM_ORANGE
#define TEAM_YELLOW

maken we

#define TEAM_ORANGE 1
#define TEAM_YELLOW 2

en voila

Geplaatst:
  • Auteur
_O_ , Het compilen werkt! Maar nu geeft hij de team-kleuren niet mee. Weet iemand hoe dit komt?

Bewerkt: door -Roy-

Een reactie plaatsen

Je kan nu een reactie plaatsen en pas achteraf registreren. Als je al lid bent, log eerst in om met je eigen account een reactie te plaatsen.

Gast
Op dit onderwerp reageren...

Recent actief 0

  • Er zijn hier geen geregistreerde gebruikers aanwezig.

Account

Navigatie

Zoeken

Zoeken

Configureer push berichten

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.