SA-MP Forums Archive
Plz I need 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)
+--- Thread: Plz I need Help (/showthread.php?tid=333477)



Plz I need Help - Elias_Haddad - 11.04.2012

Hey Guys Today I Made This cmd to change plate name, it sucessfully compiled without any error but when i use it it wont change the plate name
pawn Код:
if(strcmp(cmd, "/setplate", true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return
SendClientMessage(playerid, red,"Usage : /setplate [Plate Name]");
if(strlen(tmp))
{
SetVehicleNumberPlate(GetPlayerVehicleID(playerid), tmp);
format(string, sizeof string,"You successfully set your plate number to %s",tmp);
SendClientMessage(playerid, red, string);
}
return 1;
}
Plz I hope I Could Get Help Really Fast
Thx In Advance.


Re: Plz I need Help - ...: 1 :... - 11.04.2012

Try respawning the car.


Re: Plz I need Help - doreto - 11.04.2012

Note: The vehicle must be respawned or restreamed for the changes to take effect.<< wiki


Re: Plz I need Help - Elias_Haddad - 11.04.2012

Thx For Fast Reply , Im Going To Try


Re: Plz I need Help - Elias_Haddad - 11.04.2012

Sry For Double Post But Plz can some1 tell me how to respawn vehicle? im still noob scripter


Re: Plz I need Help - ...: 1 :... - 11.04.2012

Depends, restart server, use a command...
Relog?


Re: Plz I need Help - Skribblez - 11.04.2012

Get the vehicle ID and model
pawn Код:
new vehicle = GetPlayerVehicleID(playerid);
new model = GetVehicleModel(vehicle);
Destroy the vehicle
pawn Код:
DestroyVehicle(vehicle);
Then proceed with the vehicle plate and re-spawn
pawn Код:
SetVehicleNumberPlate(vehicle = CreateVehicle(model, x, y, z, angle, color1, color2, respawn_delay), tmp);
PutPlayerInVehicle(playerid, vehicle, 0);



Re: Plz I need Help - Elias_Haddad - 11.04.2012

Nvm I FIxed The Error But Now When i put /setplate Elias
i get spawned another place plz tell me how to fix it
now the code is :
pawn Код:
if(strcmp(cmd, "/setplate", true) == 0)
            {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp)) return
            SendClientMessage(playerid, red,"Usage : /setplate [Plate Name]");
            if(strlen(tmp))
            {
            new Float:x, Float:y, Float:z, Float:angle;
            new vehicle = GetPlayerVehicleID(playerid);
            new model = GetVehicleModel(vehicle);
            DestroyVehicle(vehicle);
            SetVehicleNumberPlate(vehicle = CreateVehicle(model, x, y, z, angle, 0, 0, 0), tmp);
            PutPlayerInVehicle(playerid, vehicle, 0);
            format(string, sizeof string,"You successfully set your plate number to %s",tmp);
            SendClientMessage(playerid, red, string);
            }
            return 1;
            }



Re: Plz I need Help - Skribblez - 11.04.2012

pawn Код:
GetVehiclePos(vehicle, x, y, z);
Reputation if I've helped you please, thanks.


Re: Plz I need Help - Elias_Haddad - 11.04.2012

where i add GetVehiclePos? yeah ofc ill rep u if it will work