PHP код:
if(strcmp(cmd, "/eventhelp", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] >= 4)
{
SendClientMessage(playerid, COLOR_WHITE,"EVENT HELP: type a command for more information");
SendClientMessage(playerid, COLOR_WHITE,"COMMANDS: /seteventpos /seteventinfo /startevent /lockevent /endevent /announceevent /quitevent");
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " You are not authorized to use that command !");
}
}
return 1;
}
if(strcmp(cmd, "/seteventpos", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] >= 4)
{
if(ActiveEvent == 0)
{
GetPlayerPos(playerid, EventX, EventY, EventZ);
EventInt = GetPlayerInterior(playerid);
EventWorld = GetPlayerVirtualWorld(playerid);
SendClientMessage(playerid, COLOR_WHITE, "You have sucessfully adjusted the event position.");
}
else
{
SendClientMessage(playerid, COLOR_GREY, " An event is already active, use /endevent to finish the current event !");
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " You are not authorized to use that command !");
}
}
return 1;
}
if(strcmp(cmd, "/seteventinfo", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] >= 4)
{
if(ActiveEvent == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /seteventinfo [name]");
SendClientMessage(playerid, COLOR_GRAD1, "Available names: Jointext, Health, Armor, Gun1, Gun2, Gun3, Gun4, Gun5");
return 1;
}
if(strcmp(tmp,"jointext",true) == 0)
{
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[128];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /seteventinfo jointext [text]");
return 1;
}
format(EventText, sizeof(EventText), "%s", result);
SendClientMessage(playerid, COLOR_WHITE, "You have been set the event jointext to the following.");
GameTextForPlayer(playerid, EventText, 5000, 0);
EventJoinText = 1;
return 1;
}
if(strcmp(tmp,"health",true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /seteventinfo [health] [amount]");
return 1;
}
new ehp = strvalEx(tmp);
if(ehp < 1 || ehp > 100) { SendClientMessage(playerid, COLOR_GREY, " Health can't be below 1 or above 100 !"); return 1; }
EventHP = ehp;
format(string, sizeof(string), "You have been set the event health to %d.", ehp);
SendClientMessage(playerid, COLOR_WHITE, string);
return 1;
}
if(strcmp(tmp,"armor",true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /seteventinfo [armor] [amount]");
return 1;
}
new earmor = strvalEx(tmp);
if(earmor < 0 || earmor > 100) { SendClientMessage(playerid, COLOR_GREY, " Armor can't be below 0 or above 100 !"); return 1; }
EventArmour = earmor;
format(string, sizeof(string), "You have been set the event armor to %d.", earmor);
SendClientMessage(playerid, COLOR_WHITE, string);
return 1;
}
if(strcmp(tmp,"gun1",true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /seteventinfo [gun1] [gunid]");
return 1;
}
new egun = strvalEx(tmp);
EventWeapon1 = egun;
format(string, sizeof(string), "You have been set the event gun1 to %d.", egun);
SendClientMessage(playerid, COLOR_WHITE, string);
return 1;
}
if(strcmp(tmp,"gun2",true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /seteventinfo [gun2] [gunid]");
return 1;
}
new egun = strvalEx(tmp);
EventWeapon2 = egun;
format(string, sizeof(string), "You have been set the event gun2 to %d.", egun);
SendClientMessage(playerid, COLOR_WHITE, string);
return 1;
}
if(strcmp(tmp,"gun3",true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /seteventinfo [gun3] [gunid]");
return 1;
}
new egun = strvalEx(tmp);
EventWeapon3 = egun;
format(string, sizeof(string), "You have been set the event gun3 to %d.", egun);
SendClientMessage(playerid, COLOR_WHITE, string);
return 1;
}
if(strcmp(tmp,"gun4",true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /seteventinfo [gun4] [gunid]");
return 1;
}
new egun = strvalEx(tmp);
EventWeapon4 = egun;
format(string, sizeof(string), "You have been set the event gun4 to %d.", egun);
SendClientMessage(playerid, COLOR_WHITE, string);
return 1;
}
if(strcmp(tmp,"gun5",true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /seteventinfo [gun5] [gunid]");
return 1;
}
new egun = strvalEx(tmp);
EventWeapon5 = egun;
format(string, sizeof(string), "You have been set the event gun5 to %d.", egun);
SendClientMessage(playerid, COLOR_WHITE, string);
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " An event is already active, use /endevent to finish the current event !");
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " You are not authorized to use that command !");
}
}
return 1;
}
if(strcmp(cmd, "/startevent", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] >= 4)
{
if(ActiveEvent == 0)
{
if(EventX == 0.0 && EventY == 0.0 && EventZ == 0.0)
{
SendClientMessage(playerid, COLOR_GREY, " The event spawn has not been set !");
return 1;
}
GetPlayerName(playerid, sendername, sizeof(sendername));
SendClientMessage(playerid, COLOR_WHITE, "You have started an event, use /announceevent to announce it to the server.");
ActiveEvent = 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, " An event is already active, use /endevent to finish the current event !");
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " You are not authorized to use that command !");
}
}
return 1;
}
if(strcmp(cmd, "/lockevent", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] >= 4)
{
if(ActiveEvent == 1)
{
EventLocked = 1;
SendClientMessageToAll(COLOR_LIGHTBLUE, "* Event: Administrator has locked the event !");
}
else
{
SendClientMessage(playerid, COLOR_GREY, " There are currently no events active !");
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " You are not authorized to use that command !");
}
}
return 1;
}
if(strcmp(cmdtext, "/quitevent", true) == 0)
{
if(IsAtEvent[playerid] != 0)
{
SetPlayerWeapons(playerid);
IsAtEvent[playerid] = 0;
ResetPlayerAdminWeaponsEx(playerid);
}
return 1;
}
if(strcmp(cmd, "/endevent", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] >= 4)
{
if(ActiveEvent == 1)
{
EventX = 0.0;
EventY = 0.0;
EventZ = 0.0;
EventInt = 0;
EventWorld = 0;
EventHP = 100;
EventArmour = 0;
ActiveEvent = 0;
EventLocked = 0;
EventWeapon1 = 0;
EventWeapon2 = 0;
EventWeapon3 = 0;
EventWeapon4 = 0;
EventWeapon5 = 0;
EventJoinText = 0;
format(EventText, sizeof(EventText), "None");
SendClientMessageToAll(COLOR_LIGHTBLUE, "* Event: Event has been finished !");
//foreach(Player, i)
for(new i; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(IsAtEvent[i] == 1)
{
SetPlayerWeapons(i);
IsAtEvent[i] = 0;
ResetPlayerAdminWeaponsEx(i);
}
}
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " There are currently no events active !");
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " You are not authorized to use that command !");
}
}
return 1;
}
if(strcmp(cmdtext, "/quitevent", true) == 0)
{
if(IsAtEvent[playerid] != 0)
{
SetPlayerWeapons(playerid);
IsAtEvent[playerid] = 0;
ResetPlayerAdminWeaponsEx(playerid);
}
return 1;
}
if(strcmp(cmd, "/endevent", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] >= 4)
{
if(ActiveEvent == 1)
{
EventX = 0.0;
EventY = 0.0;
EventZ = 0.0;
EventInt = 0;
EventWorld = 0;
EventHP = 100;
EventArmour = 0;
ActiveEvent = 0;
EventLocked = 0;
EventWeapon1 = 0;
EventWeapon2 = 0;
EventWeapon3 = 0;
EventWeapon4 = 0;
EventWeapon5 = 0;
EventJoinText = 0;
format(EventText, sizeof(EventText), "None");
SendClientMessageToAll(COLOR_LIGHTBLUE, "* Event: Event has been finished !");
//foreach(Player, i)
for(new i; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(IsAtEvent[i] == 1)
{
SetPlayerWeapons(i);
IsAtEvent[i] = 0;
ResetPlayerAdminWeaponsEx(i);
}
}
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " There are currently no events active !");
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " You are not authorized to use that command !");
}
}
return 1;
}
if(strcmp(cmd, "/announceevent", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] >= 4)
{
if(ActiveEvent == 1)
{
SendClientMessageToAll(COLOR_LIGHTBLUE, "* Event: Event has been started. /joinevent to participate !");
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You need to start the event first (/startevent) !");
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " You are not authorized to use that command !");
}
}
return 1;
}