26.09.2016, 19:35
PHP код:
if(dialogid == DIALOG_ARENAS1)
{
if(response)
{ // here the setplayerpos sets player in air.... i took these from samp site ill show ya
if(playerData[playerid][playerWantedLevel] < 3)
{
if(listitem == 0)
{
SetPlayerPos(playerid, 1412.639892,-1.787510,1000.924377);
SetPlayerInterior(playerid, 1); //kickstart arena intid
SetPlayerVirtualWorld(playerid, 20);
playerData[playerid][IsInArena1] = 1;
playerData[playerid][IsInAArena] = 1;
playerData[playerid][isInDuel] = false;
playerData[playerid][isinFREEFORALL] = false;
playerData[playerid][isInCVR] = false;
playerData[playerid][onRace1] = false;
printf("IsInDuel: %i, onRace: %i, isInCVR: %i, isinFREEFORALL: %i, ISINARENA: %b",playerData[playerid][isInDuel], playerData[playerid][onRace1], playerData[playerid][isInCVR], playerData[playerid][isinFREEFORALL], playerData[playerid][IsInAArena]);
SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid, 99);
ResetPlayerWeapons(playerid);
GivePlayerWeaponEx(playerid, WEAPON_DEAGLE, 6000);
GivePlayerWeaponEx(playerid, WEAPON_SNIPER, 6000);
}
if(listitem == 1)
{
SetPlayerPos(playerid, 1412.639892,-1.787510,1000.924377);
SetPlayerInterior(playerid, 1); //kickstart arena intid
SetPlayerVirtualWorld(playerid, 21);
playerData[playerid][IsInArena2] = 1;
playerData[playerid][IsInAArena] = 1;
playerData[playerid][isInDuel] = false;
playerData[playerid][isinFREEFORALL] = false;
playerData[playerid][isInCVR] = false;
playerData[playerid][onRace1] = false;
printf("IsInDuel: %i, onRace: %i, isInCVR: %i, isinFREEFORALL: %i, ISINARENA: %b",playerData[playerid][isInDuel], playerData[playerid][onRace1], playerData[playerid][isInCVR], playerData[playerid][isinFREEFORALL], playerData[playerid][IsInAArena]);
SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid, 99);
ResetPlayerWeapons(playerid);
GivePlayerWeaponEx(playerid, WEAPON_DEAGLE, 6000);
GivePlayerWeaponEx(playerid, WEAPON_SAWEDOFF, 6000);
}
if(listitem == 2)
{
SetPlayerPos(playerid, 1412.639892,-1.787510,1000.924377);
SetPlayerInterior(playerid, 1); //kickstart arena intid
SetPlayerVirtualWorld(playerid, 22);
playerData[playerid][IsInArena3] = 1;
playerData[playerid][IsInAArena] = 1;
playerData[playerid][isInDuel] = false;
playerData[playerid][isinFREEFORALL] = false;
playerData[playerid][isInCVR] = false;
playerData[playerid][onRace1] = false;
printf("IsInDuel: %i, onRace: %i, isInCVR: %i, isinFREEFORALL: %i, ISINARENA: %i",playerData[playerid][isInDuel], playerData[playerid][onRace1], playerData[playerid][isInCVR], playerData[playerid][isinFREEFORALL], playerData[playerid][IsInAArena]);
ResetPlayerWeapons(playerid);
SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid, 99);
GivePlayerWeaponEx(playerid, WEAPON_SHOTGSPA, 6000);
GivePlayerWeaponEx(playerid, WEAPON_MP5, 6000);
}
if(listitem == 3)
{
SetPlayerPos(playerid, 1412.639892,-1.787510,1000.924377);
SetPlayerInterior(playerid, 1); //kickstart arena intid
SetPlayerVirtualWorld(playerid, 23);
playerData[playerid][IsInArena4] = 1;
playerData[playerid][IsInAArena] = 1;
playerData[playerid][isInDuel] = false;
playerData[playerid][isinFREEFORALL] = false;
playerData[playerid][isInCVR] = false;
playerData[playerid][onRace1] = false;
printf("IsInDuel: %i, onRace: %i, isInCVR: %i, isinFREEFORALL: %i, ISINARENA: %i",playerData[playerid][isInDuel], playerData[playerid][onRace1], playerData[playerid][isInCVR], playerData[playerid][isinFREEFORALL], playerData[playerid][IsInAArena]);
SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid, 99);
ResetPlayerWeapons(playerid);
GivePlayerWeaponEx(playerid, WEAPON_SNIPER, 6000);
GivePlayerWeaponEx(playerid, WEAPON_SAWEDOFF, 6000);
}
if(listitem == 4)
{
SetPlayerPos(playerid, 1412.639892,-1.787510,1000.924377);
SetPlayerInterior(playerid, 1); //kickstart arena intid
SetPlayerVirtualWorld(playerid, 24);
playerData[playerid][IsInArena5] = 1;
playerData[playerid][IsInAArena] = 1;
playerData[playerid][isInDuel] = false;
playerData[playerid][isinFREEFORALL] = false;
playerData[playerid][isInCVR] = false;
playerData[playerid][onRace1] = false;
printf("IsInDuel: %i, onRace: %i, isInCVR: %i, isinFREEFORALL: %i, ISINARENA: %i",playerData[playerid][isInDuel], playerData[playerid][onRace1], playerData[playerid][isInCVR], playerData[playerid][isinFREEFORALL], playerData[playerid][IsInAArena]);
SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid, 99);
ResetPlayerWeapons(playerid);
GivePlayerWeaponEx(playerid, WEAPON_SNIPER, 6000);
GivePlayerWeaponEx(playerid, WEAPON_SHOTGSPA, 6000);
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "You cannot enter duel arena with wanted level!");
}
}
return 1;
}
Basically i have to check onplayerspawn if its 1, spawn player in arena otherwise normal spawn, here's onplayer spawn code:
PHP код:
if(playerData[playerid][IsInAArena] == 1) // respawn in arena if died in arena
{
if(playerData[playerid][IsInArena1] == 1)
{
SetPlayerPos(playerid, -1410.72,1591.16,1052.53);
SetPlayerInterior(playerid, 14);
SetPlayerVirtualWorld(playerid, 20);
}
else if(playerData[playerid][IsInArena2] == 1)
{
SetPlayerPos(playerid, -1410.72,1591.16,1052.53);
SetPlayerInterior(playerid, 14);
SetPlayerVirtualWorld(playerid, 21);
}
else if(playerData[playerid][IsInArena3] == 1)
{
SetPlayerPos(playerid, -1410.72,1591.16,1052.53);
SetPlayerInterior(playerid, 14);
SetPlayerVirtualWorld(playerid, 22);
}
else if(playerData[playerid][IsInArena4] == 1)
{
SetPlayerPos(playerid, -1410.72,1591.16,1052.53);
SetPlayerInterior(playerid, 14);
SetPlayerVirtualWorld(playerid, 23);
}
else if(playerData[playerid][IsInArena5] == 1)
{
SetPlayerPos(playerid, -1410.72,1591.16,1052.53);
SetPlayerInterior(playerid, 14);
SetPlayerVirtualWorld(playerid, 24);
}
SendClientMessage(playerid, -1, "You spawned in a duel arena! use /leavearena to leave the duel arena!");
return 1;
}