#include <a_samp>
#include <zcmd>
new CP[MAX_PLAYERS];
#define DIALOG_WEAPON 1
CMD:weapons(playerid, params[])
{
ShowPlayerDialog(playerid, DIALOG_WEAPON, DIALOG_STYLE_LIST, "Weapons", "AK47\nM4\nSniper Rifle", "Yes", "No");
return 1;
}
playerid The ID of the player to show the dialog to. dialogid An ID to assign this dialog to, so responses can be processed. Max dialogid is 32767. Using negative values will close any open dialog. style The style of the dialog. caption[] The title at the top of the dialog. The length of the caption can not exceed more than 64 characters before it starts to cut off. info[] The text to display in the dialog. Use \n to start a new line and \t to tabulate. button1[] The text on the left button. button2[] The text on the right button. Leave it blank to hide it.
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_WEAPON) // This checks if the dialog equals to the dialog define 'DIALOG_WEAPON', 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 (No), the dialog dissapears and nothing happens
if(response) // If there is a response (first button( Yes )) it continues
{
if(listitem == 0) // If you choose the first listitem, this happens
{
CP[playerid] = 1;
SetPlayerCheckpoint(playerid, 2745.6499,-2453.8032,13.8623, 1.0);
SendClientMessage(playerid, -1, "You have chosen the AK-47, follow the checkpoint to get the AK-47.");
return 1;
}
if(listitem == 1) // If you choose the second listitem
{
CP[playerid] = 2;
SetPlayerCheckpoint(playerid, 1579.4326,-1635.8755,13.5604, 1.0); // This creates a checkpoint at the coцrdinates: "-1051.4005,-655.8729,31.7361"
SendClientMessage(playerid, -1, "You have chosen the M4, follow the checkpoint to get the M4.");
return 1;
}
if(listitem == 2) // If you choose the third listitem
{
CP[playerid] = 3;
SetPlayerCheckpoint(playerid, 1544.9388,-1353.3195,329.4743, 1.0); // This creates a checkpoint at the coцrdinates: "-2286.7529,2282.9390,5.9015"
SendClientMessage(playerid, -1, "You have chosen the Sniper Rifle, follow the checkpoint to get the Sniper Rifle.");
return 1;
}
}
}
return 1;
}
if(dialogid == DIALOG_WEAPON) // This checks if the dialog equals to the dialog define 'DIALOG_WEAPON', 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 (No), the dialog dissapears and nothing happens
if(response) // If there is a response (first button( Yes )) it continues
if(listitem == 0) // If you choose the first listitem, this happens
{
CP[playerid] = 1;
SetPlayerCheckpoint(playerid, 2745.6499,-2453.8032,13.8623, 1.0);
SendClientMessage(playerid, -1, "You have chosen the AK-47, follow the checkpoint to get the AK-47.");
return 1;
}
if(listitem == 1) // If you choose the second listitem
{
CP[playerid] = 2;
SetPlayerCheckpoint(playerid, 1579.4326,-1635.8755,13.5604, 1.0); // This creates a checkpoint at the coцrdinates: "-1051.4005,-655.8729,31.7361"
SendClientMessage(playerid, -1, "You have chosen the M4, follow the checkpoint to get the M4.");
return 1;
}
if(listitem == 2) // If you choose the third listitem
{
CP[playerid] = 3;
SetPlayerCheckpoint(playerid, 1544.9388,-1353.3195,329.4743, 1.0); // This creates a checkpoint at the coцrdinates: "-2286.7529,2282.9390,5.9015"
SendClientMessage(playerid, -1, "You have chosen the Sniper Rifle, follow the checkpoint to get the Sniper Rifle.");
return 1;
}
public OnPlayerEnterCheckpoint(playerid)
{
if(CP[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
CP[playerid] = 4; // Changes the variable, so we can use it later again with OnPlayerEnterCheckpoint
GivePlayerWeapon(playerid, 30, 999999);
SendClientMessage(playerid, -1, "Enjoy your weapon!");
return 1;
}
if(CP[playerid] == 2) // This checks if our variable equals to 2, if so: it continues
{
DisablePlayerCheckpoint(playerid); // This makes sure that there will be a new checkpoint
CP[playerid] = 5; // Changes the variable, so we can use it later again with OnPlayerEnterCheckpoint
GivePlayerWeapon(playerid, 31, 999999);
SendClientMessage(playerid, -1, "Enjoy your weapon!");
}
if(CP[playerid] == 2) // This checks if our variable equals to 2, if so: it continues
{
DisablePlayerCheckpoint(playerid); // This makes sure that there will be a new checkpoint
CP[playerid] = 6; // Changes the variable, so we can use it later again with OnPlayerEnterCheckpoint
GivePlayerWeapon(playerid, 34, 999999);
SendClientMessage(playerid, -1, "Enjoy your weapon!");
}
return 1;
}
#include <a_samp>
#include <zcmd>
#define DIALOG_WEAPON 1
new CP[MAX_PLAYERS];
public OnPlayerEnterCheckpoint(playerid)
{
if(CP[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
CP[playerid] = 4; // Changes the variable, so we can use it later again with OnPlayerEnterCheckpoint
GivePlayerWeapon(playerid, 30, 999999);
SendClientMessage(playerid, -1, "Enjoy your weapon!");
return 1;
}
if(CP[playerid] == 2) // This checks if our variable equals to 2, if so: it continues
{
DisablePlayerCheckpoint(playerid); // This makes sure that there will be a new checkpoint
CP[playerid] = 5; // Changes the variable, so we can use it later again with OnPlayerEnterCheckpoint
GivePlayerWeapon(playerid, 31, 999999);
SendClientMessage(playerid, -1, "Enjoy your weapon!");
}
if(CP[playerid] == 2) // This checks if our variable equals to 2, if so: it continues
{
DisablePlayerCheckpoint(playerid); // This makes sure that there will be a new checkpoint
CP[playerid] = 6; // Changes the variable, so we can use it later again with OnPlayerEnterCheckpoint
GivePlayerWeapon(playerid, 34, 999999);
SendClientMessage(playerid, -1, "Enjoy your weapon!");
}
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_WEAPON) // This checks if the dialog equals to the dialog define 'DIALOG_WEAPON', 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 (No), the dialog dissapears and nothing happens
if(response) // If there is a response (first button( Yes )) it continues
{
if(listitem == 0) // If you choose the first listitem, this happens
{
CP[playerid] = 1;
SetPlayerCheckpoint(playerid, 2745.6499,-2453.8032,13.8623, 1.0);
SendClientMessage(playerid, -1, "You have chosen the AK-47, follow the checkpoint to get the AK-47.");
return 1;
}
if(listitem == 1) // If you choose the second listitem
{
CP[playerid] = 2;
SetPlayerCheckpoint(playerid, 1579.4326,-1635.8755,13.5604, 1.0); // This creates a checkpoint at the coцrdinates: "-1051.4005,-655.8729,31.7361"
SendClientMessage(playerid, -1, "You have chosen the M4, follow the checkpoint to get the M4.");
return 1;
}
if(listitem == 2) // If you choose the third listitem
{
CP[playerid] = 3;
SetPlayerCheckpoint(playerid, 1544.9388,-1353.3195,329.4743, 1.0); // This creates a checkpoint at the coцrdinates: "-2286.7529,2282.9390,5.9015"
SendClientMessage(playerid, -1, "You have chosen the Sniper Rifle, follow the checkpoint to get the Sniper Rifle.");
return 1;
}
}
}
return 1;
}
CMD:weapons(playerid, params[])
{
ShowPlayerDialog(playerid, DIALOG_WEAPON, DIALOG_STYLE_LIST, "Weapons", "AK47\nM4\nSniper Rifle", "Yes", "No");
return 1;
}
Not really something you would use daily, but still comes in handy when you need it.
Great work! |
//Tim Viec Lam [FS] Made By DTD #include <a_samp> #include <zcmd> new CP[MAX_PLAYERS]; #define DIALOG_WEAPON 1 cmd:findjobs(playerid, params[]) { ShowPlayerDialog{playerid, DIALOG_WEAPON, DIALOG_STYLE_LIST, "Viec Lam", "Trucker\nPizza\nTaxi", "Yes", "No"); return 1; } public OnPlayerEnterCheckpoint(playerid) { if(CP[playerid] == 1) { DisablePlayerCheckpoint(playerid); CP[playerid] = 4; SendClientMessage(playerid, -1, "Here"); return 1; } if(CP[playerid] == 2) { DisablePlayerCheckpoint(playerid); CP[playerid] = 5; SendClientMessage(playerid, -1, "Here"); return 1; } if(CP[playerid] == 3) { DisablePlayerCheckpoint(playerid); CP[playerid] = 6 SendClientMessage(playerid, -1, "Here"); return 1; } return 1; } public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { if(dialogid == DIALOG_WEAPON) { if(!respon) return 0; if(respon) { if(listitem == 0) { CP[playerid] = 1; SetPlayerCheckponint(playerid, 2745.6499,-2453.8032,13.8623, 1.0); SendClientMessage(playerid, -1, "You Choose Trucker!"); return 1; } if(listitem == 1) { CP[playerid] = 2; SetPlayerCheckpoint(playerid, 1579.4326,-1635.8755,13.5604, 1.0); SendClientMessage(playerid, -1, "You Chosse Pizza!"); return 1; } if(listitem == 2) { CP[playerid] = 3; SetPlayerCheckpoint(playerid, 1544.9388,-1353.3195,329.4743, 1.0); SendClientMessage(playerid, -1, "You Chosse Taxi!"); return 1; } } } return 1; }
C:\Documents and Settings\hung\Desktop\Roleplay Base Script\filterscripts\FindJob.pwn(36) : error 001: expected token: ";", but found "-identifier-" C:\Documents and Settings\hung\Desktop\Roleplay Base Script\filterscripts\FindJob.pwn(46) : error 017: undefined symbol "respon" C:\Documents and Settings\hung\Desktop\Roleplay Base Script\filterscripts\FindJob.pwn(47) : error 017: undefined symbol "respon" C:\Documents and Settings\hung\Desktop\Roleplay Base Script\filterscripts\FindJob.pwn(52) : error 017: undefined symbol "SetPlayerCheckponint" C:\Documents and Settings\hung\Desktop\Roleplay Base Script\filterscripts\FindJob.pwn(75) : warning 203: symbol is never used: "findjobs" Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 4 Errors.