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 am trying to set the IsInAArena var to 1, but it never sets to one... remains to 0
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;
}
The arenas appear to be mutually exclusive. That is: a player can only enter one arena at a time. So I'm puzzled as to why you choose to have five variables that can be either 0 or 1, as opposed to one variable that can be 1, 2, 3, 4 or 5. This is surely a lot cleaner and a lot more expandable.
You mean an array? That won't be a problem... But real problem is that those cars never change to 1 even when a player enters arena.