SA-MP Forums Archive
Number Plate Changing Command Help Needed!! - 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: Number Plate Changing Command Help Needed!! (/showthread.php?tid=250345)



Number Plate Changing Command Help Needed!! - dowster - 23.04.2011

So I'm in the process of converting all my commands to zcmd, and I decided to mess around with a number plate changer command to get away from all the copy and pasting. I believe i have all the floats in the right spots but my problem is getting it so it will set the numberplate text to what the player specified. Here's the code I have so far:
Код:
COMMAND:numplate(playerid,params[])
{
	new numplate;
	(!sscanf(params, "ui", numplate));
	new Float:x, Float:y, Float:z, Float:zr;
	new vh;
	vh = GetPlayerVehicleID(playerid);
	SetVehicleNumberPlate(vh, numplate);
	GetVehiclePos(vh, x, y, z);
	GetVehicleZAngle(vh, zr);
	SetVehicleToRespawn(vh);
	SetVehiclePos(vh, x, y, z);
	SetVehicleZAngle(vh, zr);
	return 1;
}



Re: Number Plate Changing Command Help Needed!! - [L3th4l] - 23.04.2011

pawn Код:
CMD:numplate(playerid, params[])
{
    if(isnull(params)) return SendClientMessage(playerid, COLOR_RED, "Usage: /NumPlate < Plate >");

    new
        vID = GetPlayerVehicleID(playerid),
        Float:Pos[4],
        gStr[70];
                   
    GetVehiclePos(vID, Pos[0], Pos[1], Pos[2]);
    GetVehicleZAngle(vID, Pos[3]);

    SetVehicleNumberPlate(vID, params);
    SetVehicleToRespawn(vID);
    PutPlayerInVehicle(playerid, vID, 0);

    SetVehiclePos(vID, Pos[0], Pos[1], Pos[2]);
    SetVehicleZAngle(vID, Pos[3]);

    format(gStr, sizeof(gStr), "You've set your plate to: %s", params);
    SendClientMessage(playerid, -1, gStr);
    return 1;
}



Re: Number Plate Changing Command Help Needed!! - dowster - 23.04.2011

Thanks I'll try that out,