30.04.2011, 02:21
Today I decided to make a command that changes the number plate. I did it successfully but for some reason, when I type the command it works just that it sets the vehicle like 50 feet from ground.
pawn Код:
COMMAND:plate(playerid, params[])
{
new text[32];
if(!IsPlayerInAnyVehicle(playerid))return SendClientMessage(playerid,Grey,"You need to be in a vehicle to use this command.");
if(sscanf(params,"s",text))return SendClientMessage(playerid,Grey,"Usage: /plate [text]");
if(strlen(text) > 8 || strlen(text) < 0)return SendClientMessage(playerid,Grey,"Please enter character lenghts between 0 and 8.");
if(CarSystem[playerid][HasCar] == 0)return SendClientMessage(playerid,Grey,"You need to own a vehicle inorder to use this command.");
if(GetPlayerVehicleID(playerid) == CarSystem[playerid][vID])
{
GetPlayerName(playerid,Name,sizeof(Name));
format(String,sizeof(String),"Vehicles/%s.ini",Name);
if(strcmp(Name,dini_Get(String,"Owner")) == 0)
{
new Float:aa,Float:bb,Float:cc;
new vid = GetPlayerVehicleID(playerid);
GetVehiclePos(vid, aa, bb, cc);
GetVehicleZAngle(vid, cc);
SetVehicleNumberPlate(vid, text);
SetVehicleToRespawn(vid);
SetVehiclePos(vid, aa, bb, cc);
SetVehicleZAngle(vid, cc);
PutPlayerInVehicle(playerid, vid, 0);
format(s,sizeof(s),"You have changed this vehicle's numberplate to: {FF0000}%s{03D1F5}. It will save as long as it is not changed.",text);
SendClientMessage(playerid,Cool_Blue,s);
dini_Set(String,"Plate",text);
}
}
else if(GetPlayerVehicleID(playerid) == CarSystem[playerid][vID])
{
GetPlayerName(playerid,Name,sizeof(Name));
format(String,sizeof(String),"Vehicles/%s.ini",Name);
if(strcmp(Name,dini_Get(String,"Owner")) == 1)
{
SendClientMessage(playerid,Cool_Blue,"This vehicle is not owned by you.");
}
}
return 1;
}


.
