13.07.2012, 09:23
In some servers people want briefcase pickup and when players enters it he can teleport and buy things so today i will show you.
First of all;
which is ofcource needed for scripting samp server
Next;
This is the definition of red color se instead of writing
in the sendclientmessage we will use
so it is not confusing.
Third;
So over here we made our pick pick succsesfully but if the player will enetr it nothing will happen so we will have to define that as well.
Fourth;
So over here when player will enter he will see this dialog but what ever he will select nothing will happed so we will have to set that also
Fifth;
So over it shows when a player will select items on menu this will happen hope you understood
If i helped you +rep me and change x , y , z to where you want
Conclusion
If i helped you +rep me
First of all;
pawn Код:
#include <a_samp>
#pragma tabsize 0
Next;
pawn Код:
#define red 0xFF0000FF
Код:
0xFF0000FF
Код:
red
Third;
PHP код:
new pickup;
PHP код:
public OnGameModeInit()
{
pickup = CreatePickup(1240, 23, 2034.1999, -1403.1999, 18.1000, -1);
return 1;
}
Fourth;
PHP код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
if(pickupid == pickup)
{
ShowPlayerDialog(playerid,253,DIALOG_STYLE_MSGBOX, "Health","Buy Health ($1000)\nRocketLauncher\nLS Airport","Select", "Close");
}
return 1;
}
Fifth;
PHP код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 253)
{
if(response)
{
if(listitem == 0)
{
GivePlayerMoney(playerid, -1000);
SetPlayerHealth(playerid, 100); //Health
GameTextForPlayer(playerid, "~r~Item ~g~Purchase!", 500, 0);
}
if(listitem == 1)
{
GivePlayerMoney(playerid, -15000);
GivePlayerWeapon(playerid, 35 , 5);//rocketlaucher
GameTextForPlayer(playerid, "~r~Item ~g~Purchase!", 500, 0);
}
if(listitem == 2)
{
SetPlayerPos(playerid, x , y , z);
GameTextForPlayer(playerid, "~r~Teleported!", 500, 0);
}
}
return 1;
}
return 0;
}
If i helped you +rep me and change x , y , z to where you want
Conclusion
pawn Код:
#include <a_samp>
#pragma tabsize 0
new pickup;
public OnGameModeInit()
{
pickup = CreatePickup(1240, 23, 2034.1999, -1403.1999, 18.1000, -1);
return 1;
}
public OnPlayerPickUpPickup(playerid, pickupid)
{
if(pickupid == pickup)
{
ShowPlayerDialog(playerid,253,DIALOG_STYLE_MSGBOX, "Health","Buy Health ($1000)\nRocketLauncher\nLS Airport","Select", "Close");
}
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 253)
{
if(response)
{
if(listitem == 0)
{
GivePlayerMoney(playerid, -1000);
SetPlayerHealth(playerid, 100); //Health
GameTextForPlayer(playerid, "~r~Item ~g~Purchase!", 500, 0);
}
if(listitem == 1)
{
GivePlayerMoney(playerid, -15000);
GivePlayerWeapon(playerid, 35 , 5);//rocketlaucher
GameTextForPlayer(playerid, "~r~Item ~g~Purchase!", 500, 0);
}
if(listitem == 2)
{
SetPlayerPos(playerid, x , y , z);
GameTextForPlayer(playerid, "~r~Teleported!", 500, 0);
}
}
return 1;
}
return 0;
}