Vehicles Plate System
#1

hey guys i looking for a /buyplate where when you do /buyplate it set your Car plate to Ex" Test " but i did it but when i destroy my car it just disappear..

here my whole code

Quote:

if(strcmp("/buyplate", cmdtext, true, 10) == 0)
{
ShowVehicleControlDialog(playerid);
return 1;
}
return 0;
}
stock ShowVehicleControlDialog(playerid)
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
return ShowPlayerDialog(playerid, VEHICLE_CONTROL_DIALOG, DIALOG_STYLE_LIST, "Plate System - ", "Custom Licence Plate", "Toggle", "Cancel");
}
else return SendClientMessage(playerid, COLOUR_INFORMATION, "You need to be driving a vehicle to use this command!");
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == VEHICLE_CONTROL_DIALOG && response) // Main Dialog
{
switch(listitem)
{
case 0: ShowPlayerDialog(playerid, VEHICLE_CONTROL_DIALOG+7, DIALOG_STYLE_INPUT, "Set Custom Licence Plate", "Type the text you want to be shown on your licence plate below:\n\n(Minimun: 1 Char | Maximum: 8 Chars)", "Respawn", "Cancel");
}
return 1;
}

if(dialogid == VEHICLE_CONTROL_DIALOG+7)
{
new string[128], Float:X, Float:Y, Float:Z, Float:angle;
if(strlen(inputtext) < 1 || strlen(inputtext) > return SendClientMessage(playerid, COLOUR_ERROR, "Invalid Text Length.");
else
{
format(string, sizeof(string), "Your license plate text has been set to '%s'.", inputtext);
SendClientMessage(playerid, COLOR_LIGHTRED, string);
GetPlayerPos(playerid, X, Y, Z);
GetPlayerFacingAngle(playerid, angle);
SetVehicleNumberPlate(GetPlayerVehicleID(playerid) , inputtext);
SetVehicleToRespawn(GetPlayerVehicleID(playerid));
GetPlayerPos(playerid, X, Y, Z);
SetVehiclePos(GetPlayerVehicleID(playerid), X, Y, Z);
SetVehicleZAngle(GetPlayerVehicleID(playerid), angle);
PutPlayerInVehicle(playerid, GetPlayerVehicleID(playerid), 0);
SetVehiclePos(GetPlayerVehicleID(playerid), X, Y, Z+2);
}
}
return 0;
}
public OnVehicleStreamIn(vehicleid, forplayerid)
{
for(new i = 0; i < MAX_PLAYERS; i ++)
{
if(IsPlayerConnected(i) && IsLocked[vehicleid] == 1) SetVehicleParamsForPlayer(vehicleid, forplayerid, 0, 1);
}
return 1;
}
stock LockVehicle(playerid, vehicleid)
{
for(new i = 0; i < MAX_PLAYERS; i ++)
{
if(IsPlayerConnected(i) && i != playerid)
{
IsLocked[vehicleid] = 1;
SetVehicleParamsForPlayer(vehicleid,i,0,1);
}
}
}

stock UnlockVehicle(vehicleid)
{
for(new i = 0; i < MAX_PLAYERS; i ++)
{
if(IsPlayerConnected(i))
{
IsLocked[vehicleid] = 0;
SetVehicleParamsForPlayer(vehicleid,i,0,0);
}
}
}

and it take 500$ from the player too.
Reply
#2

pawn Код:
new vehid;
vehid = GetPlayerVehicleID(playerid)
GetPlayerPos(playerid, X, Y, Z);
GetPlayerFacingAngle(playerid, angle);
SetVehicleNumberPlate(vehid , inputtext);
SetVehicleToRespawn(vehid);
GetPlayerPos(playerid, X, Y, Z);
SetVehiclePos(vehid, X, Y, Z);
SetVehicleZAngle(vehid, angle);
SetVehiclePos(vehid, X, Y, Z+2);
PutPlayerInVehicle(playerid, vehid, 0);

and what?
Reply
#3

Vehicle Plates will be reset when the car is destroyed/created. Every time a car respawns, you must reset it's plate afaik.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)