05.04.2011, 22:32
i don't know about that warning leave that sorry
pawn Код:
#include <a_samp>
#include <sscanf2>
#include <zcmd>
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Blank Filterscript by your name here");
print("--------------------------------------\n");
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
#else
#endif
public OnPlayerRequestClass(playerid, classid)
{
SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
return 1;
}
new Float:eventx, Float:eventy, Float:eventz, Float:Eventteamx[10], Float:Eventteamy[10], Float:Eventteamz[10], Event[MAX_PLAYERS], Eventwep, Eventammo, eventteam[MAX_PLAYERS], Float:eventoldposx[MAX_PLAYERS], Float:eventoldposy[MAX_PLAYERS], Float:eventoldposz[MAX_PLAYERS], eventneedplace[MAX_PLAYERS];
OnPlayerDeath(playerid, killerid)
{
if (Event[playerid] == 1)
{
Event[playerid] = 0;
eventteam[playerid] = 0;
SendClientMessage(playerid, 0xFFFFFFFF, "You have died, you are out of the event");
eventneedplace[playerid] = 1;
}
if (Event[killerid] == 1)
{
SendClientMessage(killerid, 0xFFFFFFFF, "good, another down");
return 1;
}
}
OnPlayerSpawn(playerid)
{
if (eventneedplace[playerid] == 1)
{
SetPlayerPos(playerid, eventoldposx[playerid], eventoldposy[playerid], eventoldposz[playerid]);
}
}
new eventreward, eventhealth, eventarmor, eventvehicles, eventadmin[MAX_PLAYERS];
CMD:event(playerid, params[])
{
new type[128], opt[128], num, pid;
if(IsPlayerAdmin(playerid))
if (sscanf(params, "sz", type, opt))
{
SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /event [name]");
SendClientMessage(playerid, 0xFFFFFFFF, "Available Names: new, join, kick, team, setteam, startwep, start, end");
SendClientMessage(playerid, 0xFFFFFFFF, "Available Names: reward, givereward, giveteamreward, health, armour, vehicles");
}
else if (!strcmp(type, "new", true, 3))
{
GetPlayerPos(playerid, eventx, eventy, eventz);
SendClientMessage(playerid, 0xFFFFFFFF, "You have set your current pos as the event pos");
eventadmin[playerid] = 1;
}
else if (eventx == 0.0) SendClientMessage(playerid, 0xFFFFFFFF, "You have to create the event first!");
else if (!strcmp(type, "join", true, 4))
{
if (sscanf(opt, "u", pid)) SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /event join [playerid]");
else
{
GetPlayerPos(pid, eventoldposx[pid], eventoldposy[pid], eventoldposz[pid]);
if((IsPlayerInAnyVehicle(pid)) && (eventvehicles == 1))
{
SetVehiclePos(GetPlayerVehicleID(pid), eventx, eventy, eventz);
}
else
{
SetPlayerPos(pid, eventx, eventy, eventz);
}
SendClientMessage(playerid, 0xFFFFFFFF, "You have Invited the player");
SendClientMessage(pid, 0xFFFFFFFF, "You have been invited to the event!");
SendClientMessage(pid, 0xFFFFFFFF, "Use /e to talk to others in the event");
Event[pid] = 1;
}
}
else if (!strcmp(type, "kick", true, 4))
{
if (sscanf(opt, "u", pid)) SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /event kick [playerid]");
else if (eventoldposx[pid] == 0.0) SendClientMessage(playerid, 0xFFFFFFFF, "they aren't in the event...");
else
{
SetPlayerPos(pid, eventoldposx[pid], eventoldposy[pid], eventoldposz[pid]);
SendClientMessage(playerid, 0xFFFFFFFF, "You have kicked the player from the event");
SendClientMessage(pid, 0xFFFFFFFF, "You have been kicked from the event!");
Event[pid] = 0;
eventteam[pid] = 0;
}
}
else if (!strcmp(type, "setteam", true, 7))
{
if (sscanf(opt, "i", num)) SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /event setteam [teamnumber]");
else
{
GetPlayerPos(playerid, Eventteamx[num], Eventteamy[num], Eventteamz[num]);
SendClientMessage(playerid, 0xFFFFFFFF, "You have set this teams pos to your pos");
}
}
else if (!strcmp(type, "team", true, 4))
{
if (sscanf(opt, "iu", num, pid)) SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /event team [teamid] [playerid]");
else if (Eventteamx[num] == 0) SendClientMessage(playerid, 0xFFFFFFFF, "You have not set a pos for this team");
else
{
SetPlayerPos(pid, Eventteamx[num], Eventteamy[num], Eventteamz[num]);
eventteam[pid] = num;
new string[128];
format(string, 128, "You have set the player onto team %i", num);
SendClientMessage(playerid, 0xFFFFFFFF, string);
format(string, 128, "You have been set to team %i", num);
SendClientMessage(pid, 0xFFFFFFFF, string);
}
}
else if (!strcmp(type, "startwep", true, 8))
{
if (sscanf(opt, "ii", num, pid)) SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /event startwep [wepid] [ammo]");
else if (num > 45 || num < 0 || pid > 1000) SendClientMessage(playerid, 0xFFFFFFFF, "Your loco");
else
{
SendClientMessage(playerid, 0xFFFFFFFF, "Weapon and ammo set");
Eventwep = num;
Eventammo = pid;
}
}
else if (!strcmp(type, "start", true, 5))
{
SendClientMessageToAll(0xFFFFFFFF, "The event has been started!");
if (Eventwep == 0) return 1;
else
{
for(new i; i < 200; i++)
{
if (Event[i] == 1)
{
if (eventhealth != 0)
{
SetPlayerHealth(i, eventhealth);
}
GivePlayerWeapon(i, Eventwep, Eventammo);
if (eventteam[i] != 0) SetPlayerPos(playerid, Eventteamx[eventteam[i]], Eventteamy[eventteam[i]], Eventteamz[eventteam[i]]);
}
}
}
}
else if (!strcmp(type, "end", true, 3))
{
for(new i; i < 200; i++)
{
if (Event[i] == 1)
{
Event[i] = 0;
eventteam[i] = 0;
eventx = 0.0;
SetPlayerPos(i, eventoldposx[i], eventoldposy[i], eventoldposz[i]);
}
}
SendClientMessageToAll(0xFFFFFFFF, "Event has been ended!");
}
else if (!strcmp(type, "reward", true, 6))
{
if (sscanf(opt, "i", num)) SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /event reward [amount]");
else if (num < 1 || num > 50000) SendClientMessage(playerid, 0xFFFFFFFF, "you are loco");
else
{
eventreward = num;
SendClientMessage(playerid, 0xFFFFFFFF, "reward set");
}
}
else if(!strcmp(type, "health", true, 6))
{
if(sscanf(opt, "i", num)) SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /event health [health amount]");
else if (num < 1 || num > 10000) SendClientMessage(playerid, 0xFFFFFFFF, "loco maniac, trying to kill them?");
else
{
eventhealth = num;
SendClientMessage(playerid, 0xFFFFFFFF, "Event health set");
}
}
else if(!strcmp(type, "armour", true, 6))
{
if(sscanf(opt, "i", num)) SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /event armor [armor amount]");
else if (num < 0) SendClientMessage(playerid, 0xFFFFFFFF, "you can't do that...");
else
{
eventarmor = num;
SendClientMessage(playerid, 0xFFFFFFFF, "Event armor set");
}
}
else if (!strcmp(type, "vehicles", true, 8))
{
if (sscanf(opt, "i", num)) SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /event vehicles [disable(0), enable(1)]");
else
{
eventvehicles = num;
SendClientMessage(playerid, 0xFFFFFFFF, "vehicles allowed or disallowed, note: no teams allowed");
}
}
return 1;
}