Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <Dini>
- #include <cpstream>
- #pragma tabsize 0
- #define COLOR_RED 0xFF0000AA
- #define COLOR_YELLOW 0xFFFF00AA
- #define COLOR_WHITE 0xFFFFFFAA
- #define COLOR_LIGHTBLUE 0x33CCFFAA
- #define COLOR_ORANGE 0xFF9900AA
- #define COLOR_GREEN 0x33AA33AA
- #define COLOR_GRAD1 0xB4B5B7FF
- new RampCheck;
- new InStunt[MAX_PLAYERS];
- new StuntOn;
- new playername[MAX_PLAYER_NAME];
- new str[256];
- new CD[MAX_PLAYERS];
- new CdTimer[MAX_PLAYERS];
- //==============================================================================
- public OnFilterScriptInit()
- {
- print("\nStunt FS Load...\n");
- }
- //==============================================================================
- public OnGameModeInit()
- {
- RampCheck = CPS_AddCheckpoint(1967.8470,-1422.0588,13.5723,2.0,40);
- AddStaticVehicle(522,1944.9897,-1405.3782,13.1443,194.9478,6,25); // nrg
- AddStaticVehicle(522,1941.4489,-1405.7056,13.1399,186.4512,6,25); // nrg
- AddStaticVehicle(522,1938.6359,-1407.4504,13.1453,170.6302,6,25); // nrg
- return 1;
- }
- //==============================================================================
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- new cmd[256];
- new idx;
- cmd = AGstrtok(cmdtext, idx);
- if (strcmp(cmd, "/Ramp", true) == 0 || strcmp(cmd, "/Ra", true) == 0)
- {
- SetPlayerPos(playerid,1961.2983,-1407.7300,13.5772);
- SetPlayerFacingAngle(playerid, 201.8824);
- return 1;
- }
- if (strcmp(cmd, "/StartStunt", true) == 0 || strcmp(cmd, "/SS", true) == 0)
- {
- if(!CPS_IsPlayerInCheckpoint(playerid,RampCheck)) return SendClientMessage(playerid,COLOR_RED,"You are not in the Checkpoint in the Ramp.");
- if(GetPlayerMoney(playerid)< 2000) return SendClientMessage(playerid,COLOR_RED,"Sorry, you dont have enough money, you need 2000$.");
- if(StuntOn == 1) return SendClientMessage(playerid,COLOR_RED,"Sorry, but there is a player that doing the Stunt Ramp.");
- if(InStunt[playerid] == 1) return SendClientMessage(playerid,COLOR_RED,"You already start the Stunt Ramp get to the top building!");
- if(IsPlayerInAnyVehicle(playerid)) {
- SetPlayerRaceCheckpoint(playerid,1,1817.7235,-1432.9052,35.9219,210.4877,-217.9810,1050.7249,15);
- InStunt[playerid] = 1;
- StuntOn = 1;
- GetPlayerName(playerid, playername, sizeof(playername));
- format(str, sizeof(str), "%s Has started the Stunt Ramp!", playername);
- SendClientMessageToAll(COLOR_LIGHTBLUE, str);
- SendClientMessage(playerid,COLOR_RED,"You started the Stunt Ramp, you have a minute to get to the top building!");
- for(new i=0;i<=MAX_PLAYERS;i++){
- if(IsPlayerConnected(i)){
- if(InStunt[i] == 1) {
- CdTimer[i] = SetTimerEx("CountDown", 1000, 1, "i", i);
- CD[i] = 60;
- }
- }
- }
- }
- else
- {
- return SendClientMessage(playerid,COLOR_RED,"Youre not in a car, get NRG - 500 and come.");
- }
- return 1;
- }
- return 0;
- }
- //==============================================================================
- public OnPlayerDisconnect(playerid)
- {
- InStunt[playerid] = 0;
- return 1;
- }
- //==============================================================================
- public OnPlayerDeath(playerid, killerid, reason)
- {
- if(StuntOn == 1)
- {
- if(InStunt[playerid] == 1)
- {
- InStunt[playerid] = 0;
- StuntOn = 0;
- DisablePlayerRaceCheckpoint(playerid);
- SendClientMessage(playerid,COLOR_RED,"You loss at the Stunts Ramp.");
- KillTimer(CdTimer[playerid]);
- }}
- return 1;
- }
- //==============================================================================
- public OnPlayerExitVehicle(playerid, vehicleid)
- {
- if(StuntOn == 1)
- {
- if(InStunt[playerid] == 1)
- {
- InStunt[playerid] = 0;
- StuntOn = 0;
- DisablePlayerRaceCheckpoint(playerid);
- SendClientMessage(playerid,COLOR_RED,"You loss at the Stunts Ramp, please dont exit your vehicle when you are in the Stunt Ramp!");
- KillTimer(CdTimer[playerid]);
- }
- }
- return 1;
- }
- //==============================================================================
- public OnPlayerEnterCheckpoint(playerid)
- {
- if (CPS_IsPlayerInCheckpoint(playerid,RampCheck))
- {
- if(InStunt[playerid] == 0)
- {
- SendClientMessage(playerid,COLOR_RED,"-----------------------------------");
- SendClientMessage(playerid,COLOR_RED,"/SS - To start the Stunt Ramp");
- SendClientMessage(playerid,COLOR_RED,"You need 2000$ to play the Stunt Ramp");
- SendClientMessage(playerid,COLOR_RED,"-----------------------------------");
- }}
- return 1;
- }
- //==============================================================================
- public OnPlayerEnterRaceCheckpoint(playerid)
- {
- if(InStunt[playerid] == 1)
- {
- InStunt[playerid] = 0;
- StuntOn = 0;
- GivePlayerMoney(playerid, 10000);
- DisablePlayerRaceCheckpoint(playerid);
- GetPlayerName(playerid, playername, sizeof(playername));
- format(str, sizeof(str), "%s Won the Stunt Ramp and he got 10000$!",playername);
- SendClientMessageToAll(COLOR_LIGHTBLUE, str);
- KillTimer(CdTimer[playerid]);
- }
- return 1;
- }
- //==============================================================================
- forward CountDown(playerid);
- public CountDown(playerid)
- {
- if(CD[playerid] > 0)
- {
- format(str,256,"~r~%d",CD[playerid]);
- GameTextForPlayer(playerid,str,1000,6);
- CD[playerid] = CD[playerid]-1;
- }
- else
- {
- InStunt[playerid] = 0;
- StuntOn = 0;
- DisablePlayerRaceCheckpoint(playerid);
- SendClientMessage(playerid,COLOR_RED,"You loss at the Stunt Ramp, the time is over");
- KillTimer(CdTimer[playerid]);
- }
- return 1;
- }
- //==============================================================================
- stock AGstrtok(const string[], &index)
- {
- new length = strlen(string);
- while((index < length) && (string[index] <= ' ') && (string[index] > '\r')) index++;
- new offset = index, result[30];
- while((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)) && (string[index] > '\r')) result[index - offset] = string[index], index++;
- result[index - offset] = EOS;
- return result;
- }
Advertisement
Add Comment
Please, Sign In to add comment