//onplayerconnect
ammuentrance[playerid] = CreateDynamicCP(-2024.0315, 395.4877, 35.1719, 1.0, -1,-1, -1, 20.0);
ammuexit[playerid] = CreateDynamicCP(284.7085, -41.5060, 1001.5156, 1.0, -1,-1, -1, 20.0);
gunshop[playerid] = CreateDynamicCP(295.5286, -38.5149, 1001.5156, 1.0, -1,-1, -1, 20.0);
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
if(checkpointid == ammuentrance[playerid])
{
if(walkinammu[playerid] == 1)
{
SetPlayerPos(playerid, 286.148986,-40.644397,1001.515625);
SetPlayerInterior(playerid, 1);
inammu[playerid] = 1;
walkinammu[playerid] = 0;
}
else
{
SendClientMessage(playerid, COLOR_RED,"You need to wait 3 mins before walking into ammu-nation again!");
}
}
if(checkpointid == ammuexit[playerid])
{
if(boughtguns[playerid] == 1)
{
SetPlayerInterior(playerid, 0);
inammu[playerid] = 0;
walkinammu[playerid] = 0;
leaveammu(playerid);
SetTimerEx("walkinammutimer", 180000, false, "d" , playerid);
}
else
{
SendClientMessage(playerid, COLOR_RED,"You cannot go out to battle with no weapons!");
}
}
if(checkpointid == gunshop[playerid])
{
SendClientMessage(playerid, COLOR_WHITE,"Please choose your weapons!");
ShowPlayerDialog(playerid,GUNSHOP,DIALOG_STYLE_LIST,"Weapon Store","Shotguns\nMachine Guns","Buy", "Cancel");
}
return 1;
}
//onplayerconnect ammuentrance[playerid] = CreateDynamicCP(-2024.0315, 395.4877, 35.1719, 1.0, -1,-1, playerid, 20.0); ammuexit[playerid] = CreateDynamicCP(284.7085, -41.5060, 1001.5156, 1.0, -1,-1, playerid, 20.0); gunshop[playerid] = CreateDynamicCP(295.5286, -38.5149, 1001.5156, 1.0, -1,-1, playerid, 20.0);
Why are you using player variables? :S Wouldn't it be better to use global ones?
|
// Create these in OnGameModeInit
new ammuentrance = CreateDynamicCP(-2024.0315, 395.4877, 35.1719, 1.0, -1,-1, -1, 20.0);
new ammuexit = CreateDynamicCP(284.7085, -41.5060, 1001.5156, 1.0, -1,-1, -1, 20.0);
new gunshop = CreateDynamicCP(295.5286, -38.5149, 1001.5156, 1.0, -1,-1, -1, 20.0);
// or if you're going to have more:
#define AMOUNT_OF_AMMUNATIONS (2)
new ammuentrance[AMOUNT_OF_AMMUNATIONS];
ammuentrance[0] = CreateDynamicCP(-2024.0315, 395.4877, 35.1719, 1.0, -1,-1, -1, 20.0);
ammuentrance[1] = CreateDynamicCP(1337, 1337, 1337, 1.0, -1,-1, -1, 20.0);
// etc
new
Bar_FortCarson_Enter;
Bar_FortCarson_Enter=CreateDynamicCPEx(-180.5088,1088.2109,19.7422, 1.5,0,0,-1,60.0,"Bar");
if(checkpointid == Bar_FortCarson_Enter)
{
SetPlayerPos(playerid,503.6708,-72.2202,998.7578);
SetPlayerVirtualWorld(playerid,1);
SetCameraBehindPlayer(playerid);
SetPlayerInterior(playerid,11);
}