04.02.2010, 18:13
Im making this tutorial because the first time that I wanted to do one (I was noob ), I couldn find one, on SAMP I did use search but nothing, programs dint work and Wiki tutorial, I dind understand. Hope you like it!
Pay attention!!
Ok, lets do it !! :P
How to do it:
*Step 1:Open PAWNO and press CTRL+N, then select all and delete it.
*Step 2:On top add:
*Step 3:Then, below that, we start creating the variable for the menus.
*Step 5:Now, to make the menus we need to use CreateMenu, here a example:
(You have to do that for each variable created on Step 3.)
You must add that below of:
Here a example:
*Step 6: Okay, now we have made the menu , now we just need to add some items to the menu.
Now, under CreateMenu add:
Here a example
(You can only have 12 items per menu. Or server may crash.)
Once you finish it for all, proceed to Step 7.
*Step 7: Okay, we have made a menu in the foregoing steps, now, we are going to add the effect that should make the item if you choose it. To do that, we are using the callback
So, under that callback, we must add this:
*Step 8: Now, what we want? Teleport :P, and for that case im gonna use a stock that teleports me as well my car, and shows up for everyone to what place I have gone to.(This stock is modified by me, the original one was from Fallout, so credits to him )
Here is the stock(You have to add it on the last line.):
Its easy to use, here an explanation about the TeleWithCar arguments:
Example:
Easy right? Lets go to Step 8
**[color=red]NOTE**: You will have to add:
Below #includes, #defines, forwards, etc. If you dont add it, you will have errors!
*Step 8: How can I add that stock to my menu? Its easy, just get the cords of the place you wanna teleport, and simply paste it to X, Y and Z cords. (Remember to put them twice )
So here a example:
*Step 9: Cool! We are almost finished! We just need to add a command that will show us up the menu
So, on:
callback, we just must add this:
Now it would look like this:
And thats it One more thing, remember to add at the last line
Because this is a Filterscipt
Here is the finished version of the teleport menu that I made on this tutorial:
If you did all step-by-step, you should have no problems and errors at all !
Credits:
*Just to Fallout, for the stock. :P
Hope you like it, see ya !!
Pay attention!!
Ok, lets do it !! :P
How to do it:
*Step 1:Open PAWNO and press CTRL+N, then select all and delete it.
*Step 2:On top add:
Quote:
#define FILTERSCRIPT |
Quote:
#include <a_samp> |
Quote:
#if defined FILTERSCRIPT |
Quote:
//Menu new Menu: DMZones; |
Quote:
DMZones = CreateMenu("DMZones", 1, 18.0, 102.0, 165.0, 165.0); |
You must add that below of:
Quote:
public OnFilterScriptInit() { } |
Quote:
public OnFilterScriptInit() { DMZones = CreateMenu("DMZones", 1, 18.0, 102.0, 165.0, 165.0); } |
Now, under CreateMenu add:
Quote:
AddMenuItem(MenuID, Column, "Title"); |
Quote:
public OnFilterScriptInit() { DMZones = CreateMenu("DMZones", 1, 18.0, 102.0, 165.0, 165.0); AddMenuItem(DMZones, 0, "DildoDM"); } |
Once you finish it for all, proceed to Step 7.
*Step 7: Okay, we have made a menu in the foregoing steps, now, we are going to add the effect that should make the item if you choose it. To do that, we are using the callback
Quote:
public OnPlayerSelectedMenuRow(playerid, row) |
Quote:
new Menu:CurrentMenu = GetPlayerMenu(playerid); if(CurrentMenu == DMZones) { switch(row) { case 0: { //Effect } |
Here is the stock(You have to add it on the last line.):
Quote:
stock TeleWithCar(playerid, telename[], Float:Vx, Float:Vy, Float:Vz, Float:Va, Float:Px, Float:Py, Float:Pz, Float:Pa, interior) { DMZone[playerid] = 0; ResetPlayerWeapons(playerid); TogglePlayerControllable(playerid, 1); new b[256], playerName[MAX_PLAYER_NAME]; GetPlayerName(playerid, playerName, MAX_PLAYER_NAME); if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) { SetVehiclePos(GetPlayerVehicleID(playerid),Vx,Vy,V z); SetVehicleZAngle(GetPlayerVehicleID(playerid),Va); LinkVehicleToInterior(GetPlayerVehicleID(playerid) ,interior); } else { InCar[playerid] = false; SetPlayerPos(playerid,Px,Py,Pz); SetPlayerFacingAngle(playerid,Pa); SetPlayerWorldBounds(playerid, 20000.0000, -20000.0000, 20000.0000, -20000.0000); } PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0); SetCameraBehindPlayer(playerid); SetPlayerInterior(playerid, interior); format(b, sizeof(b), "*** %s has teleported to /%s", playerName, telename); SendClientMessageToAll(COLOR_JOIN,b); } |
Quote:
TeleWithCar(playerid, telename[],X, Y, Z, Rot, X, Y, Z, Rot, interior) |
Quote:
TeleWithCar(playerid, "dildodm",2526.65,-1202.77,67.98,0,2526.65,-1202.77,67.98,0,0); |
**[color=red]NOTE**: You will have to add:
Quote:
new DMZone[MAX_PLAYERS]; new bool: InCar[MAX_PLAYERS]; |
*Step 8: How can I add that stock to my menu? Its easy, just get the cords of the place you wanna teleport, and simply paste it to X, Y and Z cords. (Remember to put them twice )
So here a example:
Quote:
public OnPlayerSelectedMenuRow(playerid, row) { new Menu:CurrentMenu = GetPlayerMenu(playerid); if(CurrentMenu == DMZones) { switch(row) { case 0: { TeleWithCar(playerid, "dildodm",2526.65,-1202.77,67.98,0,2526.65,-1202.77,67.98,0,0); GivePlayerWeapon(playerid, 10, 50);// This gives him a dildo :P } } } } |
So, on:
Quote:
public OnPlayerCommandText(playerid, cmdtext[]) { } |
Quote:
if(strcmp(cmdtext, "/teles", true) == 0) { ShowMenuForPlayer(DMZones, playerid); TogglePlayerControllable(playerid, 0); return 1; } |
Quote:
public OnPlayerCommandText(playerid, cmdtext[]) { if(strcmp(cmdtext, "/teles", true) == 0) { ShowMenuForPlayer(DMZones, playerid); TogglePlayerControllable(playerid, 0); return 1; } return 0; } |
Quote:
#endif |
Here is the finished version of the teleport menu that I made on this tutorial:
Quote:
#define FILTERSCRIPT #include <a_samp> #if defined FILTERSCRIPT //Menu new Menu: DMZones; // ================================================== ======================== // new DMZone[MAX_PLAYERS]; new bool: InCar[MAX_PLAYERS]; public OnFilterScriptInit() { DMZones = CreateMenu("DMZones", 1, 18.0, 102.0, 165.0, 165.0); AddMenuItem(DMZones, 0, "DildoDM"); } public OnPlayerSelectedMenuRow(playerid, row) { new Menu:CurrentMenu = GetPlayerMenu(playerid); if(CurrentMenu == DMZones) { switch(row) { case 0: { TeleWithCar(playerid, "dildodm",2526.65,-1202.77,67.98,0,2526.65,-1202.77,67.98,0,0); } } } } public OnPlayerCommandText(playerid, cmdtext[]) { if(strcmp(cmdtext, "/teles", true) == 0) { ShowMenuForPlayer(DMZones, playerid); TogglePlayerControllable(playerid, 0); return 1; } return 0; } #endif ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// stock TeleWithCar(playerid, telename[], Float:Vx, Float:Vy, Float:Vz, Float:Va, Float:Px, Float:Py, Float:Pz, Float:Pa, interior) { DMZone[playerid] = 0; ResetPlayerWeapons(playerid); TogglePlayerControllable(playerid, 1); new b[256], playerName[MAX_PLAYER_NAME]; GetPlayerName(playerid, playerName, MAX_PLAYER_NAME); if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) { SetVehiclePos(GetPlayerVehicleID(playerid),Vx,Vy,V z); SetVehicleZAngle(GetPlayerVehicleID(playerid),Va); LinkVehicleToInterior(GetPlayerVehicleID(playerid) ,interior); } else { InCar[playerid] = false; SetPlayerPos(playerid,Px,Py,Pz); SetPlayerFacingAngle(playerid,Pa); SetPlayerWorldBounds(playerid, 20000.0000, -20000.0000, 20000.0000, -20000.0000); } PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0); SetCameraBehindPlayer(playerid); SetPlayerInterior(playerid, interior); format(b, sizeof(b), "*** %s has teleported to /%s", playerName, telename); SendClientMessageToAll(0x74E80099,b); } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
Credits:
*Just to Fallout, for the stock. :P
Hope you like it, see ya !!