10.12.2014, 08:49
hey guys.
Ok here is my problem. I have made a robbery system for which the player must stand in the dynamic checkpoint and then he must enter a command to start robbing. I want to change it that the player doesnt have to use a command and that he goes into the checkpoint and the robbery must then start automatically. I will post all the coding i have done with this system. I will only post the coding of one shop.
Right down here i forwarded.
Right down here i declared the timers and checkpoints and such more.
Then placed the coordinates of where the checkpoint must be with a 3D Text Label.
Right down i here i made my public which does few of the things.
And i made a few things under "OnPlayerEnterDynamicCP" with the checkpoint. Right down here
Down here i made a delay public which works with the timer.
Now finally down here is the command the player must first type to rob the barber shop.
Any help will be appreciated guys. Just show me how the command's code can go into the OnPlayerEnterDynamicCP. So that the player doesnt have to enter a command to rob the store.
Ok here is my problem. I have made a robbery system for which the player must stand in the dynamic checkpoint and then he must enter a command to start robbing. I want to change it that the player doesnt have to use a command and that he goes into the checkpoint and the robbery must then start automatically. I will post all the coding i have done with this system. I will only post the coding of one shop.
Right down here i forwarded.
Код:
forward robBarber(playerid);
Код:
new robTimerB[ MAX_PLAYERS ], cp_Barber, bool: pRobbingB[ MAX_PLAYERS ], //Los Santos, Idlewood, Barber Shop bool: BarberRobbed;
Код:
Create3DTextLabel("/robbarber", COLOR_YELLOW, 413.265 , -17.957 , 1001.804, 40.0, 0, 0); cp_Barber = CreateDynamicCP(413.265 , -17.957 , 1001.804, 2.0, .interiorid = 2);
Код:
public robBarber(playerid) //Barber Shop LS { new randMoney = random(8000) + 1000; new szStr[ 128], usrName[24], string[128]; GetPlayerName( playerid, usrName, 24 ); format( szStr, 128, "%s has robbed $%d from the Barber Shop", usrName, randMoney ); SendClientMessageToAll( COLOR_ORANGERED, szStr ); format( szStr, 128, "{CC6600}[ROBBERY INFO] {FFFFFF}Robbery successful! You have earned {CC6600}$%d {FFFFFF}, Score Earned : {CC6600}1 ", randMoney ); SendClientMessage( playerid, COLOR_WHITE, szStr ); pRobbingB[ playerid ] = false; SetTimer( "barberDelay", 90000, false ); pInfo[playerid][Cash] += randMoney; pInfo[playerid][Score] += 1; pInfo[playerid][Robs] += 1; format(string, 128, "{CC6600}[ROBBERY INFO] {FFFFFF}Your robbing skill has increased to {CC6600}%d", pInfo[playerid][Robs]); SendClientMessage(playerid, COLOR_WHITE, string); new color = GetPlayerColor(playerid); if(color == COLOR_WHITE) return SetPlayerColor(playerid, COLOR_ORANGE); else if(color == COLOR_ORANGE) return SetPlayerColor(playerid, COLOR_RED); return 1; }
Код:
if (pRobbingB[playerid]) { if (checkpointid == cp_Barber) { pRobbingB[playerid] = false; KillTimer(robTimerB[playerid]); BarberRobbed = false; GameTextForPlayer(playerid, "~r~You have failed the robbery!", 1000, 3); } }
Код:
forward barberDelay( ); public barberDelay( ) { BarberRobbed = false; return true;
Код:
CMD:robbarber(playerid, params[]) //Barber Shop, Idlewood { if (pRobbingB[ playerid ]) return SendClientMessage( playerid, COLOR_RED, "ERROR:{FFFFFF} You are already robbing Idlewood Barber Shop" ); if (!IsPlayerInRangeOfPoint( playerid, 3.0, 413.265 , -17.957 , 1001.804 ) ) return SendClientMessage( playerid, COLOR_RED, "ERROR:{FFFFFF} You must be in the checkpoint at Idlewood Barber Shop to use this command!" ); if (BarberRobbed ) return SendClientMessage( playerid, COLOR_WHITE, "{CC6600}Idlewood Barber Shop {FFFFFF}has been {CC6600}robbed recently." ); robTimerB[ playerid ] = SetTimerEx( "robBarber", 30000, false, "i", playerid ); SendClientMessage( playerid, COLOR_YELLOW, "[ROBBERY INFO] You have started a robbery, it will last 30 seconds. Do not leave the checkpoint!" ); pRobbingB[ playerid ] = true; BarberRobbed = true; // format( szStr, 128, "[ROBBERY] %s has began a robbery at Idlewood Pizza!", GetName(playerid) ); // SendClientMessageToAll( COLOR_ORANGERED, szStr ); GameTextForPlayer( playerid, "~g~Robbery in process~n~~r~Do not leave the checkpoint!", 32000, 3 ); SetPlayerWantedLevel(playerid, GetPlayerWantedLevel(playerid) +2); return 1; }