Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- new Ccp[MAX_PLAYERS];
- COMMAND:work(playerid, cmdtext)
- {
- ShowPlayerDialog(playerid, 50, DIALOG_STYLE_LIST, "Choose any of those locations", "SF Race 1 /*(listitem 0)*/ \nFrom --- to --- /*(listitem 1)*/ \nFrom --- to ---/*(listitem 2)*/", "Ok", "Cancel");
- /*
- As you can see, im using "\n" to make a new line. In a messagebox it is just a new line, but with DIALOG_STYLE_LIST, it is a new listitem.
- Please NOTE: Anything always start couting from 0, not from 1.
- You can change the dialogid to anything, and an usefull thing to do, is to give the dialog an name.
- Example:
- #define MISSIONDIALOG 50
- ShowPlayerDialog(playerid, MISSIONDIALOG, DIALOG_STYLE_LIST, "Choose any of those locations", "From --- to --- \nFrom --- to --- \nFrom --- to ---", "Ok", "Cancel");
- So if you need to change the dialogs, because you're already using the dialogid, you just need to change 1 number, instead of the whole dialogid's
- */
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if(dialogid == 50 || dialogid == MISSIONDIALOG) // This checks if the dialog equals to 50, OR ( || = or , && = and ) MISSIONDIALOG. Just change it to what ever you use. You can use a switch aswell, but i just prefer just to see the whole line
- {
- if(!response) return 0; // If you press the second button (cancel), the dialog dissapears and nothing happens
- if(resposne) // if there is a response (first button( ok )) it continues
- {
- if(listitem == 0) // If you choose the first listitem, this happens
- {
- Ccp[playerid] = 1; // This will change the variable, so we can use it later on with OnPlayerEnterCheckpoint
- SetPlayerCheckpoint(playerid, -1795.0421,1103.3732,45.0752, 3.0); // SFRaceC This creates a checkpoint at the coördinates: "-269.1287,2610.6057,63.2069"
- SendClientMessage(playerid, 0xFFFFFFFF, "You started a Race. Follow the checkpoints as fast as you can.");
- return 1;
- }
- if(listitem == 1) // If you choose the second listitem
- {
- Ccp[playerid] = 13; // Why do we make this one 3, and not just 1? That is because 1 is already in use. If you look at your current OnPlayerEnterCheckpoint, you see that there already is a "if(Ccp[playerid] == 1)"
- SetPlayerCheckpoint(playerid, -1051.4005,-655.8729,31.7361, 3.0); // This creates a checkpoint at the coördinates: "-1051.4005,-655.8729,31.7361"
- SendClientMessage(playerid, 0xFFFFFFFF, "You started a Race. Follow the checkpoints as fast as you can.");
- return 1;
- }
- if(listitem == 2) // If you choose the third listitem
- {
- Ccp[playerid] = 5; // Same for this, 1, 2, 3 and 4 are already in use, so thats why we use 5
- SetPlayerCheckpoint(playerid, -2286.7529,2282.9390,5.9015, 3.0); // This creates a checkpoint at the coördinates: "-2286.7529,2282.9390,5.9015"
- SendClientMessage(playerid, 0xFFFFFFFF, "You started a Race. Follow the checkpoints as fast as you can.");
- return 1;
- }
- }
- }
- return 1; // If you're using this in your GM, then return to 1. If you're using a FS, return to 0 PLEASE NOTE: Take a good look at this, if you're returning to 1 in a FS, it will NOT work
- }
- public OnPlayerEnterCheckpoint(playerid)
- {
- if(Ccp[playerid] == 1) // This checks if our variable equals to 1, if so: it continues
- {
- DisablePlayerCheckpoint(playerid); // This makes sure that there will be a new checkpoint
- Ccp[playerid] = 2; // Changes the variable, so we can use it later again with OnPlayerEnterCheckpoint
- SetPlayerCheckpoint(playerid, -1930.9707,1076.5671,50.9935, 3.0); // Creates a new checkpoint at a different position
- return 1;
- }
- if(Ccp[playerid] == 2) // This checks if our variable equals to 2, if so: it continues
- {
- DisablePlayerCheckpoint(playerid); // This will destroy the checkpoint, so you only get your reward once
- Ccp[playerid] = 3; // Changes the variable, so we can use it later again with OnPlayerEnterCheckpoint
- SetPlayerCheckpoint(playerid, -2230.1987,1076.0427,55.3577, 3.0); // Creates a new checkpoint at a different position
- return 1;
- }
- if(Ccp[playerid] == 3) // This checks if our variable equals to 2, if so: it continues
- {
- DisablePlayerCheckpoint(playerid); // This will destroy the checkpoint, so you only get your reward once
- Ccp[playerid] = 4; // Changes the variable, so we can use it later again with OnPlayerEnterCheckpoint
- SetPlayerCheckpoint(playerid, -2590.9111,1094.3782,56.4249, 3.0); // Creates a new checkpoint at a different position
- return 1;
- }
- if(Ccp[playerid] == 4) // This checks if our variable equals to 2, if so: it continues
- {
- DisablePlayerCheckpoint(playerid); // This will destroy the checkpoint, so you only get your reward once
- Ccp[playerid] = 5; // Changes the variable, so we can use it later again with OnPlayerEnterCheckpoint
- SetPlayerCheckpoint(playerid, -2606.9106,794.0964,48.8295, 3.0); // Creates a new checkpoint at a different position
- return 1;
- }
- if(Ccp[playerid] == 5) // This checks if our variable equals to 2, if so: it continues
- {
- DisablePlayerCheckpoint(playerid); // This will destroy the checkpoint, so you only get your reward once
- Ccp[playerid] = 6; // Changes the variable, so we can use it later again with OnPlayerEnterCheckpoint
- SetPlayerCheckpoint(playerid, -2592.1206,468.0095,14.2402, 3.0); // Creates a new checkpoint at a different position
- return 1;
- }
- if(Ccp[playerid] == 6) // This checks if our variable equals to 2, if so: it continues
- {
- DisablePlayerCheckpoint(playerid); // This will destroy the checkpoint, so you only get your reward once
- Ccp[playerid] = 7; // Changes the variable, so we can use it later again with OnPlayerEnterCheckpoint
- SetPlayerCheckpoint(playerid, -2509.6260,565.3315,14.2450, 3.0); // Creates a new checkpoint at a different position
- return 1;
- }
- if(Ccp[playerid] == 7) // This checks if our variable equals to 2, if so: it continues
- {
- DisablePlayerCheckpoint(playerid); // This will destroy the checkpoint, so you only get your reward once
- Ccp[playerid] = 8; // Changes the variable, so we can use it later again with OnPlayerEnterCheckpoint
- SetPlayerCheckpoint(playerid, -2284.7966,565.8425,34.7950, 3.0); // Creates a new checkpoint at a different position
- return 1;
- }
- if(Ccp[playerid] == 8) // This checks if our variable equals to 2, if so: it continues
- {
- DisablePlayerCheckpoint(playerid); // This will destroy the checkpoint, so you only get your reward once
- Ccp[playerid] = 9; // Changes the variable, so we can use it later again with OnPlayerEnterCheckpoint
- SetPlayerCheckpoint(playerid, -2004.1255,554.2927,34.7953, 3.0); // Creates a new checkpoint at a different position
- return 1;
- }
- if(Ccp[playerid] == 9) // This checks if our variable equals to 2, if so: it continues
- {
- DisablePlayerCheckpoint(playerid); // This will destroy the checkpoint, so you only get your reward once
- Ccp[playerid] = 10; // Changes the variable, so we can use it later again with OnPlayerEnterCheckpoint
- SetPlayerCheckpoint(playerid, -1964.4161,346.3401,33.8492, 3.0); // Creates a new checkpoint at a different position
- return 1;
- }
- if(Ccp[playerid] == 10) // This checks if our variable equals to 2, if so: it continues
- {
- DisablePlayerCheckpoint(playerid); // This will destroy the checkpoint, so you only get your reward once
- Ccp[playerid] = 11; // Changes the variable, so we can use it later again with OnPlayerEnterCheckpoint
- SetPlayerCheckpoint(playerid, -1849.9379,409.4500,16.7912, 3.0); // Creates a new checkpoint at a different position
- return 1;
- }
- if(Ccp[playerid] == 11) // This checks if our variable equals to 2, if so: it continues
- {
- DisablePlayerCheckpoint(playerid); // This will destroy the checkpoint, so you only get your reward once
- Ccp[playerid] = 12; // Changes the variable, so we can use it later again with OnPlayerEnterCheckpoint
- SetPlayerCheckpoint(playerid, -1756.7081,317.2934,6.8105, 3.0); // Creates a new checkpoint at a different position
- return 1;
- }
- if(Ccp[playerid] == 12) // This checks if our variable equals to 4, if so: it continues
- {
- new Moneys = 1000 + random( 7000 ),
- Score = 30 + random( 10 ),
- Cookies = 10 + random( 20 ),
- String[ 256 ];
- foreach(Player, i)
- {
- if ( i != playerid )
- {
- FormMessage( i, -1, ""COL_OGREEN"%s{FFFFFF} has finished a The SF race, and won a prize!", PlayerName2( playerid ) );
- }
- }
- format( String, sizeof String, " ~g~ FINISHED~n~~n~~w~You finished The SF Race!~n~~n~~g~ REWARD!~n~~W~Cash:~g~~h~$%d~n~~w~Score: ~g~~h~%d~n~~w~Cookies: ~g~~h~%d",Moneys, Score, Cookies );
- Info( playerid, String,12000);
- P_DATA[ playerid ][ P_WTF_Race ] = false;
- P_DATA[ playerid ][ P_Cookies ] += Cookies;
- SetPlayerScore( playerid, GetPlayerScore( playerid ) + Score );
- GivePlayerMoney( playerid, Moneys );
- DisablePlayerCheckpoint(playerid);
- }
- return 1;
- }
- if(Ccp[playerid] == 13) // This checks if our variable equals to 3, if so: it continues
- {
- // This is the same as "if(Ccp[playerid] == 1)", didn't understand something from this? Please look back
- DisablePlayerCheckpoint(playerid);
- Ccp[playerid] = 14;
- SetPlayerCheckpoint(playerid, 2791.8650,1231.7740,10.7663, 3.0);
- SendClientMessage(playerid, 0xFFFFFFFF, "You loaded your goods, go to the next checkpoint to continue.");
- return 1;
- }
- if(Ccp[playerid] == 4) // This checks if our variable equals to 4, if so: it continues
- {
- // This is all the same as with "if(Ccp[playerid] == 2)", so if you still didn't understand anything from it, please, look back at the Ccp[playerid] == 2
- new reward, string[128];
- DisablePlayerCheckpoint(playerid);
- Ccp[playerid] = 0;// This resets the variable, so if you enter a checkpoint right now, nothing will happen
- reward = GivePlayerMoney(playerid, GetPlayerMoney(playerid) + random(5000) + 1000);
- format(string, sizeof(string), "You entered the last checkpoint. Reward: $%i", reward);
- SendClientMessage(playerid, 0xFFFFFFFF, string);
- return 1;
- }
- if(Ccp[playerid] == 5) // This checks if our variable equals to 5, if so: it continues
- {
- // This is the same as "if(Ccp[playerid] == 1 || Ccp[playeird] == 3)", didn't understand something from this? Please look back
- DisablePlayerCheckpoint(playerid);
- Ccp[playerid] = 6;
- SetPlayerCheckpoint(playerid, -1573.3285,-2730.4099,49.2886, 3.0);
- SendClientMessage(playerid, 0xFFFFFFFF, "You loaded your goods, go to the next checkpoint to continue.");
- return 1;
- }
- if(Ccp[playerid] == 6) // This checks if our variable equals to 6, if so: it continues
- {
- // This is all the same as with "if(Ccp[playerid] == 2 || Ccp[playerid] == 4)", so if you still didn't understand anything from it, please, look back at the Ccp[playerid] == 2 || Ccp[playerid] == 4
- new reward, string[128];
- DisablePlayerCheckpoint(playerid);
- Ccp[playerid] = 0;
- reward = GivePlayerMoney(playerid, GetPlayerMoney(playerid) + random(5000) + 1000);
- format(string, sizeof(string), "You entered the last checkpoint. Reward: $%i", reward);
- SendClientMessage(playerid, 0xFFFFFFFF, string);
- return 1;
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement