help with number plates + another question
#1

I'm doing number plates for vehicles and I can't see the plate.
I'm using:
Код:
for(new v; v < MAX_VEHICLES; v++)
{
    new randplate = random(1000) + 8999;
    SetVehicleNumberPlate(v, randplate);
}
whats worng here?
why isn't it shows the number on the plate?

and how can I do that the script will take only the capital letters from player's name?
for example:
the full name is Chris_Brown
the script will take only CB


thank you very much!
Reply
#2

You need to respawn or restream the vehicles.
Reply
#3

Quote:
Originally Posted by varthshenon
Посмотреть сообщение
You need to respawn or restream the vehicles.
Thanks, and about the second question you have any idea?
Reply
#4

pawn Код:
new 1[1],2[1];
strmid(1,namehere,0,strfind(namehere,"_"));
strmid(2,namehere,strfind(namehere,"_")+1,strlen(namehere));
Reply
#5

Quote:
Originally Posted by varthshenon
Посмотреть сообщение
pawn Код:
new 1[1],2[1];
strmid(1,namehere,0,strfind(namehere,"_"));
strmid(2,namehere,strfind(namehere,"_")+1,strlen(namehere));
btw, the number plates shows symbols instead numbers, why?
for example the number is: 13582112
it shows: ☺С♀#
symbols like those..

edit:

what you wrote gives me errors
Код:
david.pwn(33010) : error 001: expected token: "-identifier-", but found "-integer value-"
david.pwn(33013) : error 035: argument type mismatch (argument 1)
david.pwn(33014) : error 035: argument type mismatch (argument 1)
david.pwn(33015) : error 029: invalid expression, assumed zero
david.pwn(33015) : error 029: invalid expression, assumed zero
david.pwn(33015) : warning 215: expression has no effect
david.pwn(33015) : error 001: expected token: ";", but found "]"
david.pwn(33015) : fatal error 107: too many error messages on one line
lines:
pawn Код:
new 1[1],2[1];
new namehere[MAX_PLAYER_NAME];
GetPlayerName(playerid, namehere, sizeof(namehere));
strmid(1,namehere,0,strfind(namehere,"_"));
strmid(2,namehere,strfind(namehere,"_")+1,strlen(namehere));
format(string, sizeof(string),"%s%s,", 1[1], 2[1]);
Reply
#6

May I see your full code?
Reply
#7

look at the message above, I've edited her.

pawn Код:
for(new v; v < MAX_VEHICLES; v++)
{
     new number[64];
     new randplate = 10000000 + random(89999999);
     format(number, sizeof(number), "%d", randplate);
     SetVehicleNumberPlate(v, number);
     SetVehicleToRespawn(v);
}
Reply
#8

pawn Код:
for(new v=1; v <= MAX_VEHICLES+; v++)//There's no vehicle 0
{
     new number[32];//32 is the limit
     format(number,sizeof(number),"%d",10000000 + random(89999999));
     SetVehicleNumberPlate(v, number);
     SetVehicleToRespawn(v);printf("%d",number);//check with debug
}
"Them", not "her".

Which line give errors?
Reply
#9

Quote:
Originally Posted by varthshenon
Посмотреть сообщение
pawn Код:
for(new v=1; v <= MAX_VEHICLES+; v++)//There's no vehicle 0
{
     new number[32];//32 is the limit
     format(number,sizeof(number),"%d",10000000 + random(89999999));
     SetVehicleNumberPlate(v, number);
     SetVehicleToRespawn(v);printf("%d",number);//check with debug
}
"Them", not "her".

Which line give errors?
it's prints numbers like with two literature like: 52, 53 etc.
i want the number to be longer, for example 12354688
the number should be 8 literature
Reply
#10

I wrote this not tested. Uses sscanf2 plugin. (for getting initials)

pawn Код:
ReturnInitials(playerid)
{
    new
        PName[MAX_PLAYER_NAME],
        szSplitName1[MAX_PLAYER_NAME],
        szSplitName2[MAX_PLAYER_NAME];//these sizes can be reduced but i think its safer this way
    GetPlayerName(playerid, PName, MAX_PLAYER_NAME);
    sscanf(PName, "p<_>s[24]s[24]", szSplitName1, szSplitName2);
    strdel(PName, 0, MAX_PLAYER_NAME);
    PName[0] = szSplitName1[0];
    PName[1] = szSplitName2[0];
    return PName;
}
It returns an array, and the first two chars are the initials.

EDIT: If you want them to be made capitals search for "ToUpper" function.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)