SA-MP Forums Archive
undefined simbol - 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: undefined simbol (/showthread.php?tid=614079)



undefined simbol - Dejan12345 - 04.08.2016

Код:
new rand = random(3000) + 1500;
new string[24];
format(string, sizeof(string), "{D20000}BG-{FFFFFF}%d", rand);
SetVehicleNumberPlate(vehicleid, string);
erros
Код:
Undefined Simbol vehicleid
i add something


Re: undefined simbol - AjaxM - 04.08.2016

Test it, and tell me.

Код:
new rand = random(3000) + 1500, vehicleid = GetPlayerVehicleID(playerid);
new string[24];
format(string, sizeof(string), "{D20000}BG-{FFFFFF}%d", rand);
SetVehicleNumberPlate(vehicleid, string);



Re: undefined simbol - Dejan12345 - 04.08.2016

NOW playerid error


Re: undefined simbol - AjaxM - 04.08.2016

Show me all your scripts relating to this function of yours.


Re: undefined simbol - Dejan12345 - 04.08.2016

Код:
public OnGameModeInit()
{
SetGameModeText("BA:RP V.0.1.0");
new rand = random(3000) + 1500, vehicleid = GetPlayerVehicleID(playerid);
new string[24];
format(string, sizeof(string), "{D20000}BG-{FFFFFF}%d", rand);
SetVehicleNumberPlate(vehicleid, string);
return 1;
}



Re: undefined simbol - FreAkeD - 04.08.2016

OnGameModeInIt doesn't have a playerid paramater.

Try using it under OnPlayerConnect(playerid)?


Re: undefined simbol - jlalt - 04.08.2016

Quote:
Originally Posted by FreAkeD
Посмотреть сообщение
OnGameModeInIt doesn't have a playerid paramater.

Try using it under OnPlayerConnect(playerid)?
how player will have vehicle on his connect D: ?

after creating your vehicles add this code
PHP код:
native IsValidVehicle(vehicleid); // <- add this after a_samp include
for(new 0MAX_VEHICLESi++)
{
    if(!
IsValidVehicle(i)) continue;
    new 
rand random(3000) + 1500;
    new 
string[24];
    
format(stringsizeof(string), "{D20000}BG-{FFFFFF}%d"rand);
    
SetVehicleNumberPlate(istring);




Re: undefined simbol - Dejan12345 - 04.08.2016

tnx jlait it work i use so much rep i wil rep you tommorow


Re: undefined simbol - Stinged - 04.08.2016

Quote:
Originally Posted by jlalt
Посмотреть сообщение
how player will have vehicle on his connect D: ?

after creating your vehicles add this code
PHP код:
native IsValidVehicle(vehicleid); // <- add this after a_samp include
for(new 0MAX_VEHICLESi++)
{
    if(!
IsValidVehicle(i)) continue;
    new 
rand random(3000) + 1500;
    new 
string[24];
    
format(stringsizeof(string), "{D20000}BG-{FFFFFF}%d"rand);
    
SetVehicleNumberPlate(istring);

MAX_VEHICLES is 2000 by default. If he only has like 200 cars, it will continue looping for 1800 times for no reason.
You should use GetVehiclePoolSize instead, especially since it's under OnGameModeInit, so there will be no empty loops.

Код:
for (new i, j = GetVehiclePoolSize(); i <= j; i++)



Re: undefined simbol - Sew_Sumi - 04.08.2016

Something EVERYONE forgets, is to respawn the car once it has its plate set, otherwise you won't see it anyway.

Код:
    SetVehicleNumberPlate(i, string);
    SetVehicleToRespawn(i);
}