Change Car Plate (help) - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Change Car Plate (help) (
/showthread.php?tid=88973)
Change Car Plate (help) -
Antonio [G-RP] - 30.07.2009
Okay. I have a code to change car plate, but I want to add to it
1. To save the plate to the cars files
2. The player changing the plate must own the car.
Heres the code....
Код:
if(strcmp(cmd,"/carplate",true)==0)
{
new vehicleid = GetPlayerVehicleID(playerid);
if(PlayerInfo[playerid][pDonation] <= 1)
{
SendClientMessage(playerid,COLOR_RED,"You must have donated to be able to change your personal license plate");
return 1;
}
if(GetPlayerState(playerid) != 2)
{
SendClientMessage(playerid,COLOR_YELLOW,"You must be the driver of a Vehicle to change the personal license plate");
return 1;
}
/*if(IsPlayerInVehicleWithNoPlates(playerid,vehicleid))
{
SendClientMessage(playerid,COLOR_YELLOW,"Your vehicle does not have a personal license plate");
return 1;
}*/
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid,COLOR_YELLOW,"USAGE: /carplate [car plate text]");
SendClientMessage(playerid,COLOR_YELLOW,"NOTE: To put one or more Spaces, you must put an _ (Underslash)");
return 1;
}
if(strlen(tmp)<0 || strlen(tmp)>8)
{
SendClientMessage(playerid,COLOR_YELLOW,"Number Plates can only be 1-8 characters long!");
return 1;
}
else
{
GetVehiclePos(vehicleid,VPos[0],VPos[1],VPos[2]);
GetVehicleZAngle(vehicleid,VPos[3]);
SetVehicleNumberPlate(vehicleid,tmp);
RemovePlayerFromVehicle(playerid);
TogglePlayerControllable(playerid,false);
SetVehicleToRespawn(vehicleid);
gPlayerVehicle[playerid] = vehicleid;
SetTimerEx("VehicleTimer",700,0,"i",playerid);
SendClientMessage(playerid,COLOR_YELLOW,"There will be a very short delay while your personal license plate is set.");
return 1;
}
}
Re: Change Car Plate (help) -
Antonio [G-RP] - 30.07.2009
Bump
Re: Change Car Plate (help) -
Francis[French] - 30.07.2009
First try to intend your code, it will be easier to see bugs.
And no I haven't checked at all at your script. I never check non-indented scripts.
Re: Change Car Plate (help) -
Antonio [G-RP] - 30.07.2009
Sorry Im a beginner, whats 'intend' mean?
Re: Change Car Plate (help) -
Andom - 30.07.2009
http://forum.sa-mp.com/index.php?topic=61893.0
There you go
Re: Change Car Plate (help) -
Antonio [G-RP] - 30.07.2009
Thanks mate!
Re: Change Car Plate (help) -
Antonio [G-RP] - 30.07.2009
Wait... no there isnt any bugs. I just want to find out how I can make it
be only for the car owner, and it saves to the car files