SA-MP Forums Archive
Problem with scripts! - 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: Problem with scripts! (/showthread.php?tid=630536)



Problem with scripts! - Kiko12135 - 15.03.2017

Help guys i get random simbols when i use my command? Its %s ..
Picture: http://i.imgur.com/8mMETr0.png
Please help me i will be so happy if i fix this!

Code:
PHP код:
CMD:tablicki(playerid,params[])
{
 if(
PlayerInfo[playerid][pAdmin] >= 1337)
    {
        
RandomTablickiBukvi(RandTablickiBukvi);
        
RandomTablickiBroj(RandTablickiBroj);
        new 
str[144];
        new 
vehicleid GetPlayerVehicleID(playerid);
        new 
tablickibroj RandTablickiBukvi[5] + RandTablickiBroj[3];
        
MyVehicle[ConvertVehIDtoDYID(vehicleid)][MyVehTablicki][0] = tablickibroj;
        if(!
IsPlayerInAnyVehicle(playerid) && GetPlayerVehicleSeat(playerid) != 0) return SCM(playerid,COLOR_GRAD1,"{FF00FF}Ne ste vozac!");
        
format(strsizeof (str),"{FF0000}| Vaseto vozilo: {FFFFFF}%i {FF0000}| Nova Tablicka: {FF0000}%s |",vehicleid,MyVehicle[ConvertVehIDtoDYID(vehicleid)][MyVehTablicki][0]);
        
SCM(playerid,COLOR_GRAD1,str);
        
ZacuvajCarOwnerShip(ConvertVehIDtoDYID(vehicleid));
    }
    else
    {
     
SendClientMessage(playeridCOLOR_GRAD1"{FF4040}[RL-RP]>>[GRESKA]:{FFFFFF} {FFFFFF}Nemozete da ja koristite ovaa komanda.");
     }
    return 
1;




Re: Problem with scripts! - Toroi - 15.03.2017

I want to help you but i don't understand shit.

First, show this enum, please:

MyVehicle[vehicleid?][enum]

To see if we can do something, also, what does this

Код:
RandomTablickiBukvi(RandTablickiBukvi); 
RandomTablickiBroj(RandTablickiBroj);
and this

Код:
new tablickibroj = RandTablickiBukvi[5] + RandTablickiBroj[3];
are supposed to do?


Re: Problem with scripts! - Kiko12135 - 15.03.2017

I just dont know how array index works.
Here are the codes you asked for:
Code:
PHP код:
enum einfo
{
MyVehTablicki[64]
};
new 
MyVehicle[MAX_MYVEHS][einfo]; 
PHP код:
new TablickiBroj[] = {'1','2','3','4','5','6','7','8','9','0'};
new 
TablickiBukvi[] = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
new 
RandTablickiBukvi[15];
new 
RandTablickiBroj[9]; 
Other:
PHP код:
stock RandomTablickiBroj(data[],size sizeof(data))
{
    for(new 
i;i<size;i++) data[i] = TablickiBroj[random(sizeof(TablickiBroj))];
    
data[size] = 0;
    return 
1;
}
stock RandomTablickiBukvi(data[],size sizeof(data))
{
    for(new 
i;i<size;i++) data[i] = TablickiBukvi[random(sizeof(TablickiBukvi))];
    
data[size] = 0;
    return 
1;

This does random letters and numbers (this is for numberplate for car)