SA-MP Forums Archive
License 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: License Plate Help. (/showthread.php?tid=205183)



License Plate Help. - Hash [NL-RP] - 31.12.2010

Well i've got numbers to completely save as they're attached to the car when it is purchased but i am having trouble using Letters in the license plate

Here is what i have on OnVehicleSpawn
Код:
 
    }
    if(IsAnOwnableCar(vehicleid))
    {
        new key;
        new playerid;
        if(ForwardOwnCar(1,playerid)) { key = 1; }
        else if(ForwardOwnCar(2,playerid)) { key = 2; }
        else if(ForwardOwnCar(3,playerid)) { key = 3; }
        else { return 1; }
        format(string, sizeof(string),"%d",CarInfo[key][cPlate],CarInfo[key][cPlate]);
	    SetVehicleNumberPlate(vehicleid, string);
    }
And here is my /plate command.

Код:
   if(strcmp(cmd, "/plate", true) == 0)
    {
        if(!IsPlayerConnected(playerid))
		{
            return 0;
		}
		if(PlayerInfo[playerid][pDonateRank]!=3)
		{
		    SendClientMessage(playerid,COLOR_GRAD2,"You are not even a donator!");
    		return 1;
		}
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp))
        {
            SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /plate [number/name]");
            return 1;
        }
        else if(strlen(tmp) > 32)
        {
            SendClientMessage(playerid, COLOR_GRAD1, "ERROR: Plate text can't be longer then 32 characters (including colors).");
            return 1;
        }
        else
        {
            new Float:vx, Float:vy, Float:vz;
            new tempveh = GetPlayerVehicleID(playerid);
            GetVehiclePos(tempveh, vx, vy, vz);
            SetVehicleNumberPlate(tempveh, tmp);
            new key;
            if(ForwardOwnCar(1,playerid)) { key = 1; }
            else if(ForwardOwnCar(2,playerid)) { key = 2; }
            else if(ForwardOwnCar(3,playerid)) { key = 3; }
            else { return 1; }
            CarInfo[key][cPlate] = tmp[28];
            SetVehicleToRespawn(tempveh);
            SetVehiclePos(tempveh, vx, vy, vz);
            PutPlayerInVehicle(playerid, tempveh, 0);
        }
        return 1;
    }
Whats my problem? Can some help me fix this, or even give me a working code for license plates.