CMD:setvplate(playerid, params[])
{
new target, plate[33];
if(sscanf(params, "us[128]", target, plate)) return SendClientMessage(playerid, red, "USAGE: /setvplate [playerid] [plate name]");
if(!IsPlayerConnected(target)) return SendClientMessage(playerid, red, "ERROR: The player isnt connected!");
if(!IsPlayerInAnyVehicle(target)) return SendClientMessage(playerid, red, "ERROR: The player isn't in any vehicle");
if(strlen(plate) <= 0 || strlen(plate) > 32) return SendClientMessage(playerid, red, "The plate name must be under 32 characters!");
new vehicles = GetPlayerVehicleID(target);
new string[128], name[MAX_PLAYER_NAME],name2[MAX_PLAYER_NAME], Float:health;
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
GetPlayerName(target, name2, MAX_PLAYER_NAME);
GetVehicleHealth(vehicles, health);
SetVehicleNumberPlate(vehicles, plate);
format(string, 128, "You have set %s[%d]'s vehicle number plate to: %s!", name2, target, plate);
SendClientMessage(playerid, 0x33FF33AA, string);
format(string, 128, "%s[%d] has set your vehicles plate number to: %s!", name, target, plate);
SendClientMessage(target, 0x33FF33AA, string);
SendClientMessage(target, 0xFF0000AA, "In order for the plate name change to take affect your vehicle needs to be respawned.");
SendClientMessage(target, 0xFF0000AA, "Please wait while your vehicle is respawned.");
SetTimerEx("VehRespawn", 1000, false, "iif", target, vehicles, health);
return 1;
}
forward VehRespawn(playerid, vehicles, health);
public VehRespawn(playerid, vehicles, health)
{
SetVehicleToRespawn(vehicles);
SetVehicleHealth(vehicles, health);
SendClientMessage(playerid, 0x33FF33AA, "Your vehicle is now respawned with the new Plate number!");
return 1;
}
pawn Код:
|