03.09.2010, 02:55
Here's the code that initiates the OnPlayerSpawn code..
public RoundControl
public GameModeInit
public OnPlayerSpawn
What's wrong? The SendClientMessage on OnPlayerSpawn is not working at all.
public RoundControl
pawn Код:
public RoundControl()
{
new string[128];
if(global_RoundStarted == 0) {
new roundType;
roundType = minrand(1, 3);
if(roundType == 1) {
global_RoundType = "Free for All";
print("[script] Round Type 'Free for All' selected.");
format(string, sizeof(string), "hostname The Elimination Server: Free for All");
SendRconCommand(string);
}
else if(roundType == 2) {
global_RoundType = "Team Deathmatch";
print("[script] Round Type 'Team Deathmatch' selected.");
format(string, sizeof(string), "hostname The Elimination Server: Team Deathmatch");
SendRconCommand(string);
}
KillTimer(RoundTimer);
global_RoundStarted = 0;
print("[script] Timer 'RoundTimer' killed.");
RoundTimer = SetTimer("RoundControl", round_TimeLimit, 1);
global_RoundStarted = 1;
print("[script] Timer 'RoundTimer' started.");
}
else if(global_RoundStarted == 1) {
//Code for restarting the round from a time limit being reached.
}
return 1;
}
pawn Код:
public OnGameModeInit()
{
djson_GameModeInit();
SetGameModeText("Elimination v1");
SetTimer("ThreeSecondTimer", 3000, 1);
for(new i = 0; i <= 299; i++)
{
if(IsInvalidSkin(i)) continue;
AddPlayerClass(i, 130.8830,-68.6318,1.5781,208.4004,0,0,0,0,0,0);
}
RoundControl();
return 1;
}
pawn Код:
public OnPlayerSpawn(playerid)
{
new string[128];
if(strcmp(global_RoundType, "Free for All")) {
format(string, sizeof(string), "You are currently playing a %s!", global_RoundType);
SendClientMessage(playerid, sc_Lime, string);
}
else if(strcmp(global_RoundType, "Team Deathmatch")) {
format(string, sizeof(string), "You are currently playing a %s!", global_RoundType);
SendClientMessage(playerid, sc_Lime, string);
new RandomTeam = minrand(1, 2);
if(RandomTeam == 1) {
SetPVarInt(playerid, "Team", 1);
global_TeamPlayers1++;
SendClientMessage(playerid, sc_White, "You have been randomly placed on Team 1!");
}
else if(RandomTeam == 2) {
SetPVarInt(playerid, "Team", 2);
global_TeamPlayers2++;
SendClientMessage(playerid, sc_White, "You have been randomly placed on Team 2!");
}
}
return 1;
}