#include <a_samp>
#include <ZCMD>
#define VALOR_INFERNUS 50000
#define VALOR_SULTAN 20000
native IsValidVehicle(vehicleid);
// ------------------------------------------------------------------------- //
new
vConce[1];
// ------------------------------------------------------------------------- //
public OnGameModeInit()
{
vConce[0] = CreateVehicle(411, 0.0, 0.0, 0.0, 0.0, -1, -1, -1, -1);
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER)
{
new vehicleid = GetPlayerVehicleID(playerid);
for(new h = 0; h <= sizeof(vConce); ++ h)
{
if(vehicleid == vConce[h])
{
new string[50];
format(string, sizeof(string), "» Para adquirir esse veнculo digite /comprarveiculo.");
SendClientMessage(playerid, -1, string);
}
}
}
return 1;
}
CMD:comprarveiculo(playerid)
{
new vehicleid = GetPlayerVehicleID(playerid);
for(new h = 0; h <= sizeof(vConce); ++ h)
{
if(vehicleid != vConce[h])
SendClientMessage(playerid, -1, "* Esse veнculo nгo й da concessionбria para ser comprado.");
else
{
CompraVeiculo(playerid, vehicleid);
}
}
return 1;
}
stock CompraVeiculo(playerid, veiculoid)
{
if(IsValidVehicle(veiculoid))
{
new model = GetVehicleModel(veiculoid);
switch(model)
{
case 411: GivePlayerMoney(playerid, - VALOR_INFERNUS);
case 560: GivePlayerMoney(playerid, - VALOR_SULTAN);
}
}
}
Um Exemplo
PHP Code:
|