27.01.2012, 04:05
I'm starting on a new script of mine, but for some reason it's printing "OnGameo" into my server console whenever I start the server up, and as this makes no sense, and I really haven't gotten that far, I figured I'd post asking for help as to what's causing this;
Here's the script:
Here's the script:
pawn Код:
#include <a_samp>
#include <sscanf2_5>
#include <zcmd>
#undef MAX_PLAYERS
#define MAX_PLAYERS 20
#define s_Name "Plant the Bomb" //Server name!
#define GetPlayerNameEx(%0,%1,%2) GetPlayerName(%0, %1, %2); for(new i = 0; i != %2; i ++) if(%1[i] == '_') %1[i] = ' '
new
TeamSkin[ 6 ], //We have5 skins, 5 + \o (NULL) = 6.
Text:TeamTD_0, // - 0 is the black box on class selection!
Text:TeamTD_1, // - 1 is the Terrorist label!
Text:TeamTD_2, // - 2 is the mission description!
Text:TeamTD_3, // - 3 is the Counter Terrorist label!
Text:TeamTD_4 // - 4 is the mission description!
;
new
p_State[MAX_PLAYERS char] = -1,
/* There are 4 different nodes that this variable can have, they are listed below:
-1: Not spawned - Connecting, Disconnecting(?) / Class selection
0: Spectating - Player is currently spectating the battlefield.
1: Spawned - Player is currently spawned, killable, and spectatable.
2: Dead - Has been killed within the last (RESPAWN_DELAY) seconds. (RESPAWN_DELAY is configurable up top!)
Using this method, we should be able to accurately detect what each players state is at any time. */
p_ClassSelected[MAX_PLAYERS char] = -1
/* This is where the team character they selected is saved to their username until it is changed, so we can detect EVERY
thing a player does. */
;
public OnGameModeInit()
{
new
setup[64];
format(setup, sizeof(setup), "hostname %s", s_Name), SendRconCommand(setup);
SetGameModeText("2KY's Plant the Bomb!");
//Terrorists!
TeamSkin[ 0 ] = AddPlayerClassEx( 1, 0, 0, 0, 0, 0, 4, 1, 24, 100, 34, 100 );
TeamSkin[ 1 ] = AddPlayerClassEx( 1, 1, 0, 0, 0, 0, 4, 1, 24, 100, 34, 100 );
TeamSkin[ 2 ] = AddPlayerClassEx( 1, 299, 0, 0, 0, 0, 4, 1, 24, 100, 34, 100 );
//Counter Terrorists!
TeamSkin[ 3 ] = AddPlayerClassEx( 2, 284, 0, 0, 0, 0, 4, 1, 24, 100, 34, 100 );
TeamSkin[ 4 ] = AddPlayerClassEx( 2, 285, 0, 0, 0, 0, 4, 1, 24, 100, 34, 100 );
TeamSkin[ 5 ] = AddPlayerClassEx( 2, 286, 0, 0, 0, 0, 4, 1, 24, 100, 34, 100 );
TeamTD_0 = TextDrawCreate(496.000000, 108.000000, "_~n~~n~~n~~n~~n~~n~~n~~n~");
TextDrawBackgroundColor(TeamTD_0, 255);
TextDrawFont(TeamTD_0, 1);
TextDrawLetterSize(TeamTD_0, 0.500000, 1.000000);
TextDrawColor(TeamTD_0, -1);
TextDrawSetOutline(TeamTD_0, 0);
TextDrawSetProportional(TeamTD_0, 1);
TextDrawSetShadow(TeamTD_0, 1);
TextDrawUseBox(TeamTD_0, 1);
TextDrawBoxColor(TeamTD_0, 255);
TextDrawTextSize(TeamTD_0, 630.000000, 0.000000);
TeamTD_1 = TextDrawCreate(528.000000, 112.000000, "~r~Terrorist");
TextDrawBackgroundColor(TeamTD_1, -1);
TextDrawFont(TeamTD_1, 1);
TextDrawLetterSize(TeamTD_1, 0.500000, 1.000000);
TextDrawColor(TeamTD_1, 255);
TextDrawSetOutline(TeamTD_1, 1);
TextDrawSetProportional(TeamTD_1, 1);
TeamTD_2 = TextDrawCreate(497.000000, 128.000000, "~y~Mission :~n~___~r~Destroy ~w~the ~y~target area!");
TextDrawBackgroundColor(TeamTD_2, 255);
TextDrawFont(TeamTD_2, 3);
TextDrawLetterSize(TeamTD_2, 0.270000, 1.800000);
TextDrawColor(TeamTD_2, -1);
TextDrawSetOutline(TeamTD_2, 0);
TextDrawSetProportional(TeamTD_2, 1);
TextDrawSetShadow(TeamTD_2, 1);
TeamTD_3 = TextDrawCreate(508.000000, 112.000000, "~b~Counter Terrorist");
TextDrawBackgroundColor(TeamTD_3, -1);
TextDrawFont(TeamTD_3, 1);
TextDrawLetterSize(TeamTD_3, 0.400000, 1.000000);
TextDrawColor(TeamTD_3, 255);
TextDrawSetOutline(TeamTD_3, 1);
TextDrawSetProportional(TeamTD_3, 1);
TeamTD_4 = TextDrawCreate(497.000000, 128.000000, "~y~Mission :~n~___~b~Protect ~w~the ~y~target area!");
TextDrawBackgroundColor(TeamTD_4, 255);
TextDrawFont(TeamTD_4, 3);
TextDrawLetterSize(TeamTD_4, 0.270000, 1.799999);
TextDrawColor(TeamTD_4, -1);
TextDrawSetOutline(TeamTD_4, 0);
TextDrawSetProportional(TeamTD_4, 1);
TextDrawSetShadow(TeamTD_4, 1);
return true;
}
main()
{
print("Created by 2KY for the SA:MP Community!"); //Please leave these credits, even if it's only a print in your console window.
}
public OnPlayerConnect(playerid)
{
p_State{playerid} = -1;
SetPlayerPos(playerid, 150.2975, -64.9889, 1.5781);
SetPlayerFacingAngle(playerid, 178.2798);
SetPlayerCameraPos(playerid, 150.4190, -68.7553, 1.4297);
SetPlayerCameraLookAt(playerid, 150.2975, -64.9889, 1.5781);
return true;
}
public OnPlayerRequestClass(playerid, classid)
{
p_ClassSelected{playerid} = classid;
p_State{playerid} = -1;
ClearClassSelectionTextDraws(playerid);
switch(p_ClassSelected{playerid}) {
//Are they selecting a Terrorist Team Member? If so - Show them this!
case 0..2: {
TextDrawShowForPlayer(playerid, TeamTD_0);
TextDrawShowForPlayer(playerid, TeamTD_1);
TextDrawShowForPlayer(playerid, TeamTD_2);
}
//Are they selecting a Counter Terrorist Team Member? If so - Show them this!
case 3..5: {
TextDrawShowForPlayer(playerid, TeamTD_0);
TextDrawShowForPlayer(playerid, TeamTD_3);
TextDrawShowForPlayer(playerid, TeamTD_4);
}
}
return 1;
}
public OnPlayerRequestSpawn(playerid)
{
return 1;
}
public OnPlayerSpawn(playerid)
{
ClearClassSelectionTextDraws(playerid);
p_State{playerid} = 1;
return true;
}
public OnPlayerDeath(playerid, killerid, reason)
{
p_State{playerid} = 2;
return true;
}
public OnPlayerDisconnect(playerid, reason)
{
p_State{playerid} = -1;
p_ClassSelected{playerid} = -1;
return true;
}
stock ClearClassSelectionTextDraws(playerid)
{
TextDrawHideForPlayer(playerid, TeamTD_0);
TextDrawHideForPlayer(playerid, TeamTD_1);
TextDrawHideForPlayer(playerid, TeamTD_2);
TextDrawHideForPlayer(playerid, TeamTD_3);
TextDrawHideForPlayer(playerid, TeamTD_4);
return 1;
}