30.01.2011, 06:26
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
and it take 500$ from the player too.
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); } } } |