Problem With Vehicle Number Plate System
#1

I've got a problem when i compile here is my code

pawn Код:
public OnVehicleSpawn(vehicleid)
{
SetVehicleNumberPlate(vehicleid, "SAMP %d", vehicleid);
SetVehicleToRespawn(vehicleid);
return 1;
}
and its returning

Quote:

gamemode(480) : warning 202: number of arguments does not match definition

I'm kind of a noob to PAWN coding, how can i fix this?
Reply
#2

https://sampwiki.blast.hk/wiki/SetVehicleNumberPlate
https://sampwiki.blast.hk/wiki/Format

And this topic should be in scripting discussion for 0.3c RC.
Reply
#3

pawn Код:
public OnVehicleSpawn(vehicleid)
{
new str[128]; format(str, sizeof str, "SAMP %i", vehicleid);
SetVehicleNumberPlate(vehicleid, str);
SetVehicleToRespawn(vehicleid);
return 1;
}
Reply
#4

Quote:
Originally Posted by iTorran
Посмотреть сообщение
pawn Код:
public OnVehicleSpawn(vehicleid)
{
new str[128]; format(str, sizeof str, "SAMP %i", vehicleid);
SetVehicleNumberPlate(vehicleid, str);
SetVehicleToRespawn(vehicleid);
return 1;
}
Thanks i'm farther than i was, but its only showing the first 2 numbers of the vehicle id.
Reply
#5

The number plate max lenght is 32, not use 128 cell. Use 32.
Reply
#6

Quote:
Originally Posted by tonysmith13
Посмотреть сообщение
Thanks i'm farther than i was, but its only showing the first 2 numbers of the vehicle id.
This is because basically the number plate lengths 8 characters.
Any string longer than that can still be shown, but will out of boundary.
Having a max length of 32 is for color embedding, not for 32 characters.
Reply
#7

Make your own command, like /plate <name/number>. Here's an example:


The code below post on your GM/FS top (depends what you're using)
pawn Код:
#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
Now on OnPlayerCommandText:

Add:
pawn Код:
dcmd(plate,5,cmdtext);
Will be like this:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
   dcmd(plate,5,cmdtext);
   // Any other stuff underneath
   return 0;
}

On the end of GM/FS (depending what you're using), put that:
pawn Код:
dcmd_plate(playerid,params[])
{
   
   new ID = GetPlayerVehicleID(playerid);
   new string[128];
   if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0x00FFFFFF, "You're not in a vehicle");
   if(!strlen(params)) return SendClientMessage(playerid, 0x00FFFFFF, "Usage: /plate <number/name>");
   else
   {
       SetVehicleNumberPlate(ID, params);
       SetVehicleToRespawn(ID);
       format(string,sizeof(string),"{F216FA}You've changed your{00EEFF} VehicleID: {D9FA00}%d {FAD900}plate's for: {00FF88}%s",GetVehicleModel(ID),params);
       SendClientMessage(playerid, 0x00FFFFFF, string);
       PlayerPlaySound(playerid, 1133, 0.0, 0.0, 0.0);
   }
   return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)