IRP:endevent(playerid, var[])
{
if(!Logged(playerid)) return NoLogin(playerid);
if(Player[playerid][pAdmin] < 4) return NoAuth(playerid);
if(!EventOn) return SendClientMessage(playerid, COLOR_GRAD2, "There's no current event happening.");
SendClientMessageToAll(COLOR_LIGHTRED, "** The event has ended.");
foreach(Player, i)
{
if(Event[i])
{
GunsBeingRemoved[i] = 1;
ResetPlayerWeapons(i);
GunsBeingRemoved[playerid] = 1;
SetPlayerPos(i, Player[i][pXp], Player[i][pY], Player[i][pZ]);
SetPlayerInterior(i, Player[i][pInt]);
SetPlayerVirtualWorld(i, Player[i][pVW]);
SetPlayerHealth(i, Player[i][pHealth]);
SetPlayerArmour(i, Player[i][pArmor]);
for(new w = 0; w < 13; w++)
{
GiveZamoraWeapon(i, Player[i][pWeapon][w], Player[i][pWeaponAmmo][w]);
}
Event[i] = 0;
}
EventOn = 0; EventLocked = 0;
ePos[0] = 0; ePos[1] = 0; ePos[2] = 0; EventWep[0] = 0; EventWep[1] = 0; EventWep[2] = 0;
eInt = 0; eVW = 0; EventHealth = 0; EventArmor = 0;
}
return 1;
}
foreach(new i:Player) if(IsPlayerConnected(i))
Player[playerid][pX] = 0
|
Not more ? Else, it's why the player is teleported to 0.0 0.0 0.0.
SetPlayerPos(i, Player[i][pXp], Player[i][pY], Player[i][pZ]); You call variable "Player[i][pXp]" but he is initialized to 0.0, where is the problem ? You have no bugs, just stupidity. |
IRP:joinevent(playerid, var[])
{
if(!Logged(playerid)) return NoLogin(playerid);
if(Player[playerid][pEBanned]) return SendClientMessage(playerid, COLOR_GRAD2, "You are banned from joining events.");
if(IsPlayerTazed(playerid) && IsPlayerCuffed(playerid) && IsPlayerTied(playerid)) return SendClientMessage(playerid, COLOR_GRAD2, "You are not allowed to join events at the moment");
if(Player[playerid][pDead]) return SendClientMessage(playerid, COLOR_GRAD2, "You are not allowed to join the event while you are injured.");
if(Event[playerid]) return SendClientMessage(playerid, COLOR_GRAD2, "You are already in the event.");
if(!EventOn) return SendClientMessage(playerid, COLOR_GRAD2, "There's no current event happening.");
if(EventLocked) return SendClientMessage(playerid, COLOR_GRAD2, "The event is locked, be faster next time.");
if(EventType == 1)
{
Player[playerid][pInt] = GetPlayerInterior(playerid);
Player[playerid][pVW] = GetPlayerVirtualWorld(playerid);
GetPlayerPos(playerid, Player[playerid][pX], Player[playerid][pY], Player[playerid][pZ]);
GetPlayerHealth(playerid, Player[playerid][pHealth]);
GetPlayerArmour(playerid, Player[playerid][pArmor]);
SetPlayerPos(playerid, ePos[0], ePos[1], ePos[2]);
SetPlayerInterior(playerid, eInt);
SetPlayerVirtualWorld(playerid, eVW);
for(new i=0; i<13; i++)
{
GetPlayerWeaponData(playerid, i, Player[playerid][pWeapon][i], Player[playerid][pWeaponAmmo][i]);
}
GunsBeingRemoved[playerid] = 1;
ResetPlayerWeapons(playerid);
Event[playerid] = 1;
SendClientMessage(playerid, COLOR_LIGHTRED, "** Please wait until the event starts and you will recieve everything set by the organizer.");
SendClientMessage(playerid, COLOR_LIGHTRED, "** Your original health, armor and weapons will be refunded once you leave the event, /quitevent to leave at any time.");
}
else if(EventType == 2)
{
Player[playerid][pColor] = GetPlayerColor(playerid);
Player[playerid][pModel] = GetPlayerSkin(playerid);
Player[playerid][pInt] = GetPlayerInterior(playerid);
Player[playerid][pVW] = GetPlayerVirtualWorld(playerid);
GetPlayerPos(playerid, Player[playerid][pX], Player[playerid][pY], Player[playerid][pZ]);
GetPlayerHealth(playerid, Player[playerid][pHealth]);
GetPlayerArmour(playerid, Player[playerid][pArmor]);
SetPlayerPos(playerid, ePos[0], ePos[1], ePos[2]);
SetPlayerInterior(playerid, eInt);
SetPlayerVirtualWorld(playerid, eVW);
for(new i=0; i<13; i++)
{
GetPlayerWeaponData(playerid, i, Player[playerid][pWeapon][i], Player[playerid][pWeaponAmmo][i]);
}
GunsBeingRemoved[playerid] = 1;
ResetPlayerWeapons(playerid);
Event[playerid] = 1;
new rr = random(2);
if(rr == 1)
{
SetPlayerSkin(playerid, 230);
EventTeam[playerid] = 1;
}
else if(rr == 2)
{
SetPlayerSkin(playerid, 137);
EventTeam[playerid] = 2;
}
SendClientMessage(playerid, COLOR_LIGHTRED, "** Please wait until the event starts and you will recieve everything set by the organizer.");
SendClientMessage(playerid, COLOR_LIGHTRED, "** Your original health, armor and weapons will be refunded once you leave the event, /quitevent to leave at any time.");
SendClientMessage(playerid, COLOR_LIGHTRED, "** Please stay at your team base till the event starts.");
}
return 1;
}
SetPlayerPos(i, Player[i][pXp], Player[i][pY], Player[i][pZ]);
// In /joinevent
GetPlayerPos(playerid, Player[playerid][pX], Player[playerid][pY], Player[playerid][pZ]);
// In /endevent
SetPlayerPos(i, Player[i][pXp], Player[i][pY], Player[i][pZ]);
IRP:endevent(playerid, var[])
{
if(!Logged(playerid)) return NoLogin(playerid);
if(Player[playerid][pAdmin] < 4) return NoAuth(playerid);
if(!EventOn) return SendClientMessage(playerid, COLOR_GRAD2, "There's no current event happening.");
SendClientMessageToAll(COLOR_LIGHTRED, "** The event has ended.");
foreach(Player, i) if(IsPlayerConnected(i))
{
if(Event[i])
{
GunsBeingRemoved[i] = 1;
ResetPlayerWeapons(i);
GunsBeingRemoved[playerid] = 1;
printf("[DEBUG SA-MP FORUM]: i : %d | pX : %f | pY : %f | pZ : %f", i, Player[i][pX], Player[i][pY], Player[i][pZ]);
SetPlayerPos(i, Player[i][pX], Player[i][pY], Player[i][pZ]);
SetPlayerInterior(i, Player[i][pInt]);
SetPlayerVirtualWorld(i, Player[i][pVW]);
SetPlayerHealth(i, Player[i][pHealth]);
SetPlayerArmour(i, Player[i][pArmor]);
for(new w = 0; w < 13; w++)
{
GiveZamoraWeapon(i, Player[i][pWeapon][w], Player[i][pWeaponAmmo][w]);
}
Event[i] = 0;
}
EventOn = 0; EventLocked = 0;
ePos[0] = 0; ePos[1] = 0; ePos[2] = 0; EventWep[0] = 0; EventWep[1] = 0; EventWep[2] = 0;
eInt = 0; eVW = 0; EventHealth = 0; EventArmor = 0;
}
return 1;
}