public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(plate, 5, cmdtext);
return 0;
}
public dcmd_plate(playerid, params[])
{
if(!IsPlayerInAnyVehicle(playerid)){
SendClientMessage(playerid, 0x999999AA, "You are not in a vehicle");
return 1;
}else{
SetVehicleNumberPlate(GetPlayerVehicleID(playerid), params);
}
return 1;
}
public OnPlayerCommandText(....)
?:S
dcmd_plate(playerid, params[])
{
// Setup local variables
new vehicleid, engine, lights, alarm, doors, bonnet, boot, objective, Plate[32];
// Get the player's vehicle
vehicleid = GetPlayerVehicleID(playerid);
if (vehicleid != 0)
{
if (sscanf(params, "s[32]", Plate)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/plate <NumberPlate>\"");
else
{
// Set the numberplate
SetVehicleNumberPlate(vehicleid, Plate);
// Remove the player from the vehicle
RemovePlayerFromVehicle(playerid);
// Respawn the vehicle
SetVehicleToRespawn(vehicleid);
// Put the player back in the vehicle
PutPlayerInVehicle(playerid, vehicleid, 0);
// Turn on the engine and lights of the vehicle
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vehicleid, 1, 1, alarm, doors, bonnet, boot, objective);
}
}
else
SendClientMessage(playerid, 0x00FF00FF, "You must be inside a vehicle to change your numberplate");
// Let the server know that this was a valid command
return 1;
}
|
I don't know if anyone of you noticed, but OnPlayerCommandText IS public in his code ..
@OP: You need to respawn the vehicle for SetVehicleNumberPlate to work. |