SA-MP Forums Archive
Help with a command. - 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: Help with a command. (/showthread.php?tid=325269)



Help with a command. - sniperwars - 12.03.2012

Hi guys,

I was thinking of scripting a command called /setlicenseplate but I'm not sure where to start.
I want the command in STRCMP format. It doesn't have to save the license plate on disconnect.
Whoever helps me with this command will receive 1 reputation point from me.

Thanks

Sean (aka Fr3ak - sniperwars)


Re: Help with a command. - Faisal_khan - 12.03.2012

Add this under OnPlayerCommandText(playerid, cmdtext[])
pawn Код:
if (strcmp("/setlicenseplate", cmdtext, true, 10) == 0) {
        new Float:x,Float:y,Float:z,Float:ang;
        GetVehiclePos(GetPlayerVehicleID(playerid),x,y,z);
        GetVehicleZAngle(GetPlayerVehicleID(playerid),ang);
        if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,0xFFFFFFFF,"You're not in a vehicle!");
        ShowPlayerDialog(playerid,0,DIALOG_STYLE_INPUT,"{EE7777}Vehicle Numberplate","{00CC66}Input your new vehicle numberplate below.","Yes","Cancel");
        return 1; }
This under public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
pawn Код:
if(dialogid == 0) {
        if(response) {
            new Float:x,Float:y,Float:z,Float:ang;
            SetVehicleNumberPlate(GetPlayerVehicleID(playerid), inputtext);
            GetVehiclePos(GetPlayerVehicleID(playerid),x,y,z);
            GetVehicleZAngle(GetPlayerVehicleID(playerid),ang);
            SetVehicleToRespawn(GetPlayerVehicleID(playerid));
            SetVehiclePos(GetPlayerVehicleID(playerid),x,y,z);
            PutPlayerInVehicle(playerid,GetPlayerVehicleID(playerid),0);
            SetVehicleZAngle(GetPlayerVehicleID(playerid),ang);
        } else {
            SendClientMessage(playerid,0xFFFFFFFF,"You cancelled!"); } }
    return 1; }



Re: Help with a command. - Faisal_khan - 12.03.2012

worked?


Re: Help with a command. - sniperwars - 12.03.2012

It worked but It respawns the vehicle each time you change the license plate.


Re: Help with a command. - Faisal_khan - 12.03.2012

pawn Код:
if(dialogid == 0) {
        if(response) {
            new Float:x,Float:y,Float:z,Float:ang;
            SetVehicleNumberPlate(GetPlayerVehicleID(playerid), inputtext);
        } else {
            SendClientMessage(playerid,0xFFFFFFFF,"You cancelled!"); } }
    return 1; }
use this.

Instead of
pawn Код:
if(dialogid == 0) {
        if(response) {
            new Float:x,Float:y,Float:z,Float:ang;
            SetVehicleNumberPlate(GetPlayerVehicleID(playerid), inputtext);
            GetVehiclePos(GetPlayerVehicleID(playerid),x,y,z);
            GetVehicleZAngle(GetPlayerVehicleID(playerid),ang);
            SetVehicleToRespawn(GetPlayerVehicleID(playerid));
            SetVehiclePos(GetPlayerVehicleID(playerid),x,y,z);
            PutPlayerInVehicle(playerid,GetPlayerVehicleID(playerid),0);
            SetVehicleZAngle(GetPlayerVehicleID(playerid),ang);
        } else {
            SendClientMessage(playerid,0xFFFFFFFF,"You cancelled!"); } }
    return 1; }



Re: Help with a command. - sniperwars - 12.03.2012

Doesn't work, but thanks.