[FR si possible] Help me for a beginner script !
#1

Hello, i am a beginner of script in sa-mp and i made a small script for a server semi-rp:

Код:
#include <a_samp>

#define TEAM_CIVIL 1 //Premiиre Team.
#define TEAM_LVPD 2 //Deuxiиme Team.
#define TEAM_SWAT 3 //Troisiиme Team.
#define TEAM_LSES 4 //Quatriиme Team.
#define TEAM_GANG 5 //Cinquiиme Team.
#define TEAM_MAFIA 6 //Sixiиme Team.

#define COLOR_TEAM_CIVIL 0xFFFFFFAA
#define COLOR_TEAM_LVPD 0x33CCFFAA
#define COLOR_TEAM_SWAT 0x2641FEAA
#define COLOR_TEAM_LSES 0xAA3333AA
#define COLOR_TEAM_GANG 0xC2A2DAAA
#define COLOR_TEAM_MAFIA 0x000000AA

new gTeam[MAX_PLAYERS]; //La variable.

public OnGameModeInit()
{
AddPlayerClass(282,2290.1653,2426.7061,10.8203,178.6992,0,0,0,0,0,0); //Skin 1 (Team Civil)
AddPlayerClass(282,2290.1653,2426.7061,10.8203,178.6992,0,0,0,0,0,0); //Skin 2 (Team LVPD)
AddPlayerClass(285,2290.1653,2426.7061,10.8203,178.6992,0,0,0,0,0,0); //Skin 3 (Team S.W.A.T)
AddPlayerClass(282,2290.1653,2426.7061,10.8203,178.6992,0,0,0,0,0,0); //Skin 4 (Team Lses)
AddPlayerClass(282,2290.1653,2426.7061,10.8203,178.6992,0,0,0,0,0,0); //Skin 5 (Team Gang)
AddPlayerClass(102, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0); //Skin 6 (Team Mafia)xx
//https://sampwiki.blast.hk/wiki/AddPlayerClass pour plus d'informations.
//https://sampwiki.blast.hk/wiki/CreateVehicle pour plus d'informations.
return 1;
}

SetPlayerTeamFromClass(playerid, classid)
{
if(classid == 0) //Le skin 1.
{
gTeam[playerid] = 1; 
GameTextForPlayer(playerid,"~w~Civil",1000,4);
}
if(classid == 1) //Le skin 2.
{
gTeam[playerid] = 2; 
GameTextForPlayer(playerid,"~b~LVPD",1000,4); 
}
if(classid == 2) //Le skin 3.
{
gTeam[playerid] = 3;
GameTextForPlayer(playerid,"~b~SWAT",1000,4);
}
if(classid == 3) //Le skin 4.
{
gTeam[playerid] = 4;
GameTextForPlayer(playerid,"~r~LSES",1000,4); 
}
if(classid == 4) //Le skin 5.
{
gTeam[playerid] = 5;
GameTextForPlayer(playerid,"~p~Gangster",1000,4);
}
if(classid == 5) //Le skin 6.
{
gTeam[playerid] = 6; //Vous pouvez mettre gTeam[playerid] = TEAM_MAFIA ou bien le numйro que vous avez mit.
GameTextForPlayer(playerid,"~l~Mafieux",1000,4); //Plus d'informations sur https://sampwiki.blast.hk/wiki/GameTextF...5593return 1;
}

SetPlayerToTeamColor(playerid)
{
	if (gTeam[playerid] == 1)
	{
	SetPlayerColor(playerid, COLOR_TEAM_CIVIL);
	}
	if (gTeam[playerid] == 2)
	{
	SetPlayerColor(playerid, COLOR_TEAM_LVPD);
	}
	if (gTeam[playerid] == 3)
	{
	SetPlayerColor(playerid, COLOR_TEAM_SWAT);
	}
	if (gTeam[playerid] == 4)
	{
	SetPlayerColor(playerid, COLOR_TEAM_LSES);
	}
	if (gTeam[playerid] == 5)
	{
	SetPlayerColor(playerid, COLOR_TEAM_GANG);
	}
	if (gTeam[playerid] == 6) //Vous pouvez mettre comme au dessus. gTeam[playerid] == TEAM_BALLAS ou le numйro.
	{
	SetPlayerColor(playerid, COLOR_TEAM_MAFIA); //Ici vous mettez la couleur que vous avez dйfinit pour la team.
	}
}

OnPlayerRequestClass(playerid, classid)
{
SetPlayerInterior(playerid,0); //L'intйrieur.
SetPlayerPos(playerid, 2009.1027,1545.5873,12.6005); //Position du joueur.
SetPlayerCameraPos(playerid, 2035.4021, 1545.5260, 17.1395);
SetPlayerCameraLookAt(playerid, 2034.4015, 1545.4773, 16.9471);

SetPlayerTeamFromClass(playerid, classid); //Plus besoin d'expliquer je crois.
return 1;
}

public OnPlayerSpawn(playerid)
{
SetPlayerToTeamColor(playerid); //La couleur du joueur lors du spawn.
}
if(gTeam[playerid] == TEAM_CIVIL)
{
SetPlayerInterior(playerid, 0); //L'intйrieur ou les joueurs de la team police spawn.
SetPlayerPos(playerid, 2858.7573,1312.2932,11.3906); //La position ou les joueurs de la team spawn.
GivePlayerWeapon(playerid, 0, 0); //Le policier spawn avec un deagle 70 balles.
}
if(gTeam[playerid] == TEAM_LVPD)
{
SetPlayerInterior(playerid, 0); //L'intйrieur ou les joueurs de la team ballas spawn.
SetPlayerPos(playerid, 2290.1653,2426.7061,10.8203); //La position ou les joueurs de la team spawn.
GivePlayerWeapon(playerid, 22, 150); //Le gangster spawn avec un AK-47 250 balles.
}
if(gTeam[playerid] == TEAM_SWAT)
{
SetPlayerInterior(playerid, 0); //L'intйrieur ou les joueurs de la team ballas spawn.
SetPlayerPos(playerid, 2290.1653,2426.7061,10.8203); //La position ou les joueurs de la team spawn.
GivePlayerWeapon(playerid, 22, 150); //Le gangster spawn avec un AK-47 250 balles.
}
if(gTeam[playerid] == TEAM_LSES)
{
SetPlayerInterior(playerid, 0); //L'intйrieur ou les joueurs de la team ballas spawn.
SetPlayerPos(playerid, 1579.4246,1781.5286,10.8203); //La position ou les joueurs de la team spawn.
GivePlayerWeapon(playerid, 22, 150); //Le gangster spawn avec un AK-47 250 balles.
}
if(gTeam[playerid] == TEAM_GANG)
{
SetPlayerInterior(playerid, 0); //L'intйrieur ou les joueurs de la team ballas spawn.
SetPlayerPos(playerid, 1922.4635,-1120.1049,26.1114); //La position ou les joueurs de la team spawn.
GivePlayerWeapon(playerid, 22, 150); //Le gangster spawn avec un AK-47 250 balles.
}
if(gTeam[playerid] == TEAM_MAFIA)
{
SetPlayerInterior(playerid, 0); //L'intйrieur ou les joueurs de la team ballas spawn.
SetPlayerPos(playerid, 1922.4635,-1120.1049,26.1114); //La position ou les joueurs de la team spawn.
GivePlayerWeapon(playerid, 22, 150); //Le gangster spawn avec un AK-47 250 balles.
}
return 1;
}
and the compiler of pawno tells me:

C:\Users\Zitoun\Desktop\Serveur SAMP\gamemodes\LVPD-Mods.pwn(66) : error 017: undefined symbol "SetPlayerToTeamColor"
C:\Users\Zitoun\Desktop\Serveur SAMP\gamemodes\LVPD-Mods.pwn(94) : error 004: function "OnPlayerRequestClass" is not implemented
C:\Users\Zitoun\Desktop\Serveur SAMP\gamemodes\LVPD-Mods.pwn(105) : warning 225: unreachable code
C:\Users\Zitoun\Desktop\Serveur SAMP\gamemodes\LVPD-Mods.pwn(105) : error 029: invalid expression, assumed zero
C:\Users\Zitoun\Desktop\Serveur SAMP\gamemodes\LVPD-Mods.pwn(105) : error 004: function "OnPlayerSpawn" is not implemented
C:\Users\Zitoun\Desktop\Serveur SAMP\gamemodes\LVPD-Mods.pwn(107) : error 017: undefined symbol "SetPlayerToTeamColor"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


5 Errors.

WHY? HELP ME PLEASE?

Partie francais (lol) :

En gros, je veut faire un petit script disons police et voleur en semi-rp bref, le problиme c'est que j'en suis au team et je n'est rien compris en quoi j'ai fait des erreurs comme quand on me dit que "SetPlayerToTeamColor" n'est pas dйfinit alors qu'elle n'a pas a кtre dйfinit, j'y comprend donc j'aimerai que quelqu'un me corrige car sa ne devrai pas кtre trиs compliquer et je le remercie d'avance!
Reply
#2

The "undefined" errors mean that you need to define the word.Secondly, the error at the 94th line means that you deleted "OnPlayerRequestClass" same goes for the 105th line as well.

Added: Why did you even delete those public's in the fist place?If you don't use them you don't have to delete them..
Reply
#3

You have missed a closed bracket at SetPlayerTeamFromClass function and all the functions/callbacks are basically inside the function. Fix that and most of them will be fixed, plus add "public" keyword before the name of the callback as the above user said.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)