|------------------------------------------------------------------|
|Moze li mi neko pomoci kako da pocem da skriptam. |
|------------------------------------------------------------------|
[POMOC] Kako Poceti Skriptati
496
pregleda
9
postova
22. Apr. 2014.
Citaj pravila druze, ali evo pomocicu ti, ja kako sam naucio tako cu ti reci. Ako znas engleski uzmi engleski forum vezan za skriptanje sa-mp talaskaj sta sve ima, zatim uzmi obican GM preporucujem ti GTARP uzmi prevedi ga, tokom prevodjenja ukapiraces neke stvarcice, zatim pocni da pravis osnovne komande ,kick,slap,slay,ban itd, zatim reg/log sistem , poslove i sve ces ukapirati tako sam ja ukapirao 😉
23. Apr. 2014.
prvo moras enum napraviti naprimjer ovako
zatim definiras ovako
zatim ti to ide ovako..evo ti neke primjere..
enum
{
DIALOG_LOGIN,
DIALOG_WELCOME,
DIALOG_WEAPONS
}
zatim definiras ovako
#define DIALOG_LOGIN 1
#define DIALOG_WELCOME 2
#define DIALOG_WEAPONS 3
//moras definirati pod drugim brojevim 1,2,3 i tako dalje 4,5,6,7 ako me kuziszatim ti to ide ovako..evo ti neke primjere..
// Primjer za DIALOG_STYLE_MSGBOX:
ShowPlayerDialog(playerid, DIALOG_WELCOME, DIALOG_STYLE_MSGBOX, "Obavjest", "Konektirali ste se na server", "Zatvori", "");
// Primjer za DIALOG_STYLE_INPUT:
ShowPlayerDialog(playerid,DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Prijava", "Unesite svoj password:", "Prijava", "Odustani");
// Primjer za DIALOG_STYLE_LIST:
ShowPlayerDialog(playerid, DIALOG_WEAPONS, DIALOG_STYLE_LIST, "Oruzja", "AK47\nM4\nSniper Rifle", "Opcija 1", "Opcija 2");
//Primjer za DIALOG_STYLE_PASSWORD
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Prijava", "Unesite svoj password:", "Prijava", "Odustani");24. Apr. 2014.
ali naravno jos trebas public za dialog evo ti primjer pa malo mozgaj
DIALOG_STYLE_MSGBOX
DIALOG_STYLE_INPUT/DIALOG_STYLE_PASSWORD
DIALOG_STYLE_LIST
To ti je to...
DIALOG_STYLE_MSGBOX
// Define the dialog ID so we can handle responses
#define DIALOG_RULES 1
// In some command
ShowPlayerDialog(playerid, DIALOG_RULES, DIALOG_STYLE_MSGBOX, "Server Rules", "- No Cheating\n- No Spamming\n- Respect Admins\n\nDo you agree to these rules?", "Yes", "No");
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_RULES)
{
if(response) // If they clicked 'Yes' or pressed enter
{
SendClientMessage(playerid, COLOR_GREEN, "Thank you for agreeing to the server rules!");
}
else // Pressed ESC or clicked cancel
{
KickWithMessage(playerid, COLOR_RED, "You MUST agree to the server rules to play here.");
//For info & code of this function please refer to the bottom of this article.
}
return 1; // We handled a dialog, so return 1. Just like OnPlayerCommandText.
}
return 0; // You MUST return 0 here! Just like OnPlayerCommandText.
}DIALOG_STYLE_INPUT/DIALOG_STYLE_PASSWORD
#define DIALOG_LOGIN 2
// In some command
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Login", "Please enter your password:", "Login", "Cancel");
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_LOGIN)
{
if(!response) // If they clicked 'Cancel' or pressed esc
{
KickWithMessage(playerid, COLOR_RED, "You MUST login to play here. Please change your name.");
//For info & code of this function please refer to the bottom of this article.
}
else // Pressed ENTER or clicked 'Login' button
{
if(CheckPassword(playerid, inputtext))
{
SendClientMessage(playerid, COLOR_RED, "You are now logged in!");
}
else
{
SendClientMessage(playerid, COLOR_RED, "LOGIN FAILED.");
// Re-show the login dialog
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Login", "Please enter your password:", "Login", "Cancel");
}
}
return 1; // We handled a dialog, so return 1. Just like OnPlayerCommandText.
}
return 0; // You MUST return 0 here! Just like OnPlayerCommandText.
}
DIALOG_STYLE_LIST
#define DIALOG_WEAPONS 3
// In some command
ShowPlayerDialog(playerid, DIALOG_WEAPONS, DIALOG_STYLE_LIST, "Weapons", "Desert Eagle\nAK-47\nCombat Shotgun", "Select", "Close");
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_WEAPONS)
{
if(response) // If they clicked 'Select' or double-clicked a weapon
{
// Give them the weapon
switch(listitem)
{
case 0: GivePlayerWeapon(playerid, WEAPON_DEAGLE, 14); // Give them a desert eagle
case 1: GivePlayerWeapon(playerid, WEAPON_AK47, 120); // Give them an AK-47
case 2: GivePlayerWeapon(playerid, WEAPON_SHOTGSPA, 28); // Give them a Combat Shotgun
}
}
return 1; // We handled a dialog, so return 1. Just like OnPlayerCommandText.
}
return 0; // You MUST return 0 here! Just like OnPlayerCommandText.
}To ti je to...
24. Apr. 2014.
Pardon jos trebas i ovo
KickWithMessage
KickWithMessage
forward KickPublic(playerid);
public KickPublic(playerid) { Kick(playerid); }
stock KickWithMessage(playerid, color, message[])
{
SendClientMessage(playerid, color, message);
SetTimerEx("KickPublic", 1000, 0, "d", playerid); //Delay of 1 second before kicking the player so he recieves the message
}Morate biti prijavljeni da biste odgovorili na ovu temu.
Prijava