25.11.2010, 13:04
Alright I've got a huge problem. I've scripted a escape system for my prison but it ain't working like it suppose to do.
The timers don't work.. and people don't need to wait when they're doing /startescape.
This are all the codes.
/startescape
/takeitems
SetTimer's.
The jailed functions
If anyone knows how to fix this, please comment below. Because I tried alot of things but it's still bugged.
The timers don't work.. and people don't need to wait when they're doing /startescape.
This are all the codes.
/startescape
Код:
if(strcmp(cmd, "/startescape", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new loca = PlayerInfo[playerid][pLocal];
if(loca >= 1)
{
if(PlayerInfo[playerid][pCarLic] == 1)
{
if(PlayerInfo[playerid][pBoatLic] == 1)
{
if(PlayerInfo[playerid][pGunLic] == 1)
{
PlayerInfo[giveplayerid][pJailTime] = 80;
PlayerInfo[playerid][pLocal] = 0;
TogglePlayerControllable(playerid, 0);
format(string, sizeof(string), "* %s takes out a screwdriver and starts creating a hole in the cell.", RemoveUnderScore(playerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SendClientMessage(playerid, COLOR_GREY, " Use /time so you can see how much time is left to escape. ");
ApplyAnimation(playerid, "BOMBER", "BOM_Plant",4.0,0,0,0,0,0);
PlayerInfo[playerid][pJailed] = 3;
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " You don't have all items you need (( /items ))!");
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " You don't have all items you need (( /items ))!");
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " You don't have all items you need (( /items ))!");
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " You are not at your cell.");
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " You are not logged in.");
}
return 1;
}
Код:
if(strcmp(cmd, "/takeitems", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerToPoint(2.0,playerid,-3.0717,-2525.9612,36.6484))
{
if(PlayerInfo[playerid][pCarLic] == 1)
{
if(PlayerInfo[playerid][pBoatLic] == 1)
{
if(PlayerInfo[playerid][pGunLic] == 1)
{
ApplyAnimation(playerid,"DEALER","shop_pay",4.1,0,0,0,0,0);
SafeGivePlayerMoney(playerid, 12000);
PlayerInfo[playerid][pDrugs] ++;
PlayerInfo[playerid][pDrugs] ++;
PlayerInfo[playerid][pDrugs] ++;
PlayerInfo[playerid][pDrugs] ++;
PlayerInfo[playerid][pDrugs] ++;
PlayerInfo[playerid][pDrugs] ++;
PlayerInfo[playerid][pDrugs] ++;
PlayerInfo[playerid][pDrugs] ++;
PlayerInfo[playerid][pDrugs] ++;
PlayerInfo[playerid][pDrugs] ++;
PlayerInfo[playerid][pExp]++;
PlayerInfo[playerid][pExp]++;
PlayerInfo[playerid][pCarLic] = 0;
PlayerInfo[playerid][pBoatLic] = 0;
PlayerInfo[playerid][pGunLic] = 0;
SendClientMessage(playerid, COLOR_WHITE, " You've gained $12,000.");
SendClientMessage(playerid, COLOR_WHITE, " You've gained 10 drug grams.");
SendClientMessage(playerid, COLOR_WHITE, " You've gained 2 respect points.");
SetTimer("sirens", 10000, 0);
SetTimer("handsuptimer", 18000, 0);
SetTimer("comingcloser1", 24000, 0);
SetTimer("comingcloser2", 26000, 0);
SetTimer("aftercloser", 30000, 0);
SetTimer("gobacktoprison", 160000, 0);
OnPlayerUpdate(playerid);
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " You don't have all items (( /items ))!");
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " You don't have all items (( /items ))!");
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " You don't have all items (( /items ))!");
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " You are not at the place to take any items!");
}
}
return 1;
}
Код:
public sirens(playerid)
{
if(IsPlayerConnected(playerid))
{
SendClientMessage(playerid, COLOR_YELLOW, "*** LOUD SIRENS *** LOUD SIRENS ***");
}
return 1;
}
public handsuptimer(playerid)
{
if(IsPlayerConnected(playerid))
{
SendClientMessage(playerid, COLOR_WHITE, "Police Officer screaming: FREEZE! Put your hands above your head now!.");
SendClientMessage(playerid, COLOR_WHITE, "Police Officer screaming: DO IT NOW ASSHOLE!.");
TogglePlayerControllable(playerid, 0);
ApplyAnimation(playerid, "ROB_BANK","SHP_HandsUp_Scr", 4.0, 0, 1, 1, 1, 0);
ApplyAnimation(playerid, "ROB_BANK","SHP_HandsUp_Scr", 4.0, 0, 1, 1, 1, 0);
}
return 1;
}
public comingcloser1(playerid)
{
if(IsPlayerConnected(playerid))
{
SendClientMessage(playerid, COLOR_PURPLE, "* You hear footsteps coming closer. (( Police Officer ))");
SendClientMessage(playerid, COLOR_WHITE, "Police Officer Says: You're arrested for escaping from prison.");
}
return 1;
}
public comingcloser2(playerid)
{
if(IsPlayerConnected(playerid))
{
SendClientMessage(playerid, COLOR_WHITE, "Police Officer Says: You have the rights to remain silent.");
}
return 1;
}
public aftercloser(playerid)
{
if(IsPlayerConnected(playerid))
{
SendClientMessage(playerid, COLOR_GRAD1, "*** You're in the police department to get interrogated . ***");
SetPlayerPos(playerid, 1515.2794,-1655.7809,13.5392);
SetPlayerCameraPos(playerid, 1522.6932,-1659.2925,13.5392);
SetPlayerCameraLookAt(playerid, 1550.1801,-1675.3385,15.2923);
GameTextForPlayer(playerid, "~w~Waiting to get placed in prison after the exam", 9000, 1);
}
return 1;
}
public gobacktoprison(playerid)
{
if(IsPlayerConnected(playerid))
{
GameTextForPlayer(playerid, "~r~You've been placed back in prison", 4000, 1);
SetCameraBehindPlayer(playerid);
SetPlayerPos(playerid,1164.8295,-2841.3337,19.6513);
TogglePlayerControllable(playerid, 1);
PlayerInfo[playerid][pEscaped] += 1;
PlayerPlaySound(playerid, 1035, 0.0, 0.0, 0.0);
}
return 1;
}
Код:
if(PlayerInfo[i][pJailed] > 0)
{
if(PlayerInfo[i][pJailTime] > 0 && WantLawyer[i] == 0)
{
PlayerInfo[i][pJailTime]--;
}
if(PlayerInfo[i][pJailTime] <= 0 && WantLawyer[i] == 0)
{
PlayerInfo[i][pJailTime] = 0;
if(PlayerInfo[i][pJailed] == 1)
{
SetPlayerInterior(i, 0);
PlayerInfo[i][pInt] = 0;
SetPlayerPos(i,1795.4786,-1656.2434,-13.6735);
}
else if(PlayerInfo[i][pJailed] == 2)
{
SetPlayerWorldBounds(i,20000.0000,-20000.0000,20000.0000,-20000.0000); //Reset world to player
SetPlayerInterior(i, 0);
PlayerInfo[i][pInt] = 0;
SetPlayerPos(i, 1795.4786,-1656.2434,-13.6735);
}
else if(PlayerInfo[i][pJailed] == 3)
{
SetPlayerWorldBounds(i,20000.0000,-20000.0000,20000.0000,-20000.0000); //Reset world to player
SetPlayerInterior(i, 0);
TogglePlayerControllable(i, 1);
PlayerInfo[i][pInt] = 0;
SetPlayerPos(i, 1081.0354,-1634.8341,-25.8495);
}
PlayerInfo[i][pJailed] = 0;
format(string, sizeof(string), "~g~Freedom~n~~w~You've been released");
GameTextForPlayer(i, string, 5000, 1);
if(gTeam[i] == 4) { gTeam[i] = 3; }
ClearCrime(i);
SetPlayerToTeamColor(i);
}
}


