20.03.2015, 15:58
Quote:
Hi guys, i want to ask how to add buyable cars in my server?, i used SATDM gamemode by MoNeYPiMp :P
|
PHP код:
public OnPlayerSpawn(playerid)
{
SetPlayerCheckpoint(playerid, 1956.2844,1342.8551,15.3746, 3.0);
return 1;
}
PHP код:
public OnPlayerEnterCheckpoint(playerid)
{
ShowPlayerDialog(playerid, DIALOG_CARS, DIALOG_STYLE_LIST, "Car Shop", "Stretch\nInfernus\nBullet\nSuper GT\nHotring Racer\nElegy\nSultan\nBF Injection\nJester\nCheetah", "Select", "Cancel");
return 1;
}
PHP код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_CARS)
{
if(response) //
{
//
switch(listitem)
{
case 0:{
if(GetPlayerMoney(playerid) >= 245000)
{
CreateVehicle(409, 1956.2844,1342.8551,15.3746,99.8131, 0, 1, 60); // Car 2
GivePlayerMoney(playerid, -1500);
}
if(GetPlayerMoney(playerid) < 245000)
{
SendClientMessage(playerid, -1, "You Dont Have Enough Money");
}
}
case 1:{
if(GetPlayerMoney(playerid) >= 160000)
{
CreateVehicle(411, 1956.2844,1342.8551,15.3746,99.8131, 0, 1, 60); // Car 2
GivePlayerMoney(playerid, -1500);
}
if(GetPlayerMoney(playerid) < 160000)
{
SendClientMessage(playerid, -1, "You Dont Have Enough Money");
}
}
case 2:{
if(GetPlayerMoney(playerid) >= 140000)
{
CreateVehicle(541, 1956.2844,1342.8551,15.3746,99.8131, 0, 1, 60); // Car 2
GivePlayerMoney(playerid, -1500);
}
if(GetPlayerMoney(playerid) < 140000)
{
SendClientMessage(playerid, -1, "You Dont Have Enough Money");
}
}
case 3:{
if(GetPlayerMoney(playerid) >= 80000)
{
CreateVehicle(506, 1956.2844,1342.8551,15.3746,99.8131, 0, 1, 60); // Car 2
GivePlayerMoney(playerid, -1500);
}
if(GetPlayerMoney(playerid) < 80000)
{
SendClientMessage(playerid, -1, "You Dont Have Enough Money");
}
}
case 4:{
if(GetPlayerMoney(playerid) >= 120000)
{
CreateVehicle(494, 1956.2844,1342.8551,15.3746,99.8131, 0, 1, 60); // Car 2
GivePlayerMoney(playerid, -1500);
}
if(GetPlayerMoney(playerid) < 120000)
{
SendClientMessage(playerid, -1, "You Dont Have Enough Money");
}
}
case 5:{
if(GetPlayerMoney(playerid) >= 100000)
{
CreateVehicle(562, 1956.2844,1342.8551,15.3746,99.8131, 0, 1, 60); // Car 2
GivePlayerMoney(playerid, -1500);
}
if(GetPlayerMoney(playerid) < 100000)
{
SendClientMessage(playerid, -1, "You Dont Have Enough Money");
}
}
case 6:{
if(GetPlayerMoney(playerid) >= 45000)
{
CreateVehicle(560, 1956.2844,1342.8551,15.3746,99.8131, 0, 1, 60); // Car 2
GivePlayerMoney(playerid, -1500);
}
if(GetPlayerMoney(playerid) < 45000)
{
SendClientMessage(playerid, -1, "You Dont Have Enough Money");
}
}
case 7:{
if(GetPlayerMoney(playerid) >= 65000)
{
CreateVehicle(424, 1956.2844,1342.8551,15.3746,99.8131, 0, 1, 60); // Car 2
GivePlayerMoney(playerid, -1500);
}
if(GetPlayerMoney(playerid) < 65000)
{
SendClientMessage(playerid, -1, "You Dont Have Enough Money");
}
}
case 8:{
if(GetPlayerMoney(playerid) >= 60000)
{
CreateVehicle(559, 1956.2844,1342.8551,15.3746,99.8131, 0, 1, 60); // Car 2
GivePlayerMoney(playerid, -1500);
}
if(GetPlayerMoney(playerid) < 60000)
{
SendClientMessage(playerid, -1, "You Dont Have Enough Money");
}
}
case 9:{
if(GetPlayerMoney(playerid) >= 125000)
{
CreateVehicle(415, 1956.2844,1342.8551,15.3746,99.8131, 0, 1, 60); // Car 2
GivePlayerMoney(playerid, -1500);
}
if(GetPlayerMoney(playerid) < 125000)
{
SendClientMessage(playerid, -1, "You Dont Have Enough Money");
}
}
}
}
return 1; // We handled a dialog, so return 1. Just like OnPlayerCommandText.
}
return 0; // You MUST return 0 here! Just like OnPlayerCommandText.
}