SA-MP Forums Archive
Help with small prob - 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: Help with small prob (/showthread.php?tid=172575)



Help with small prob - FireCat - 30.08.2010

Anyone know how could i make like when i type /rcar it gives a random car? rcar = random car xD
_______________________
1-3$ fix warnings 1-5$fix errors
6-15$ make gamemodes(not roleplay) 3-10$ make filterscripts-scriptfiles
Dont ASK! me RolePlay questions
www.mefreeroam.tk



Re: Help with small prob - CyNiC - 30.08.2010

Yes, use CreateVehicle(random(212),...); but check if the random isn't 0.


Re: Help with small prob - FireCat - 30.08.2010

wait i dont get it O.o


Re: Help with small prob - [XST]O_x - 30.08.2010

pawn Код:
if(strcmp(cmdtext,"/rcar",true) == 0)
    {
        new car = randomEx(400,611),vehicleid;
        new Float:x,Float:y,Float:z,Float:a;
        GetPlayerPos(playerid,x,y,z);
        GetPlayerFacingAngle(playerid,a);
        vehicleid = CreateVehicle(car,x,y,z,a,-1,-1,-1);
        PutPlayerInVehicle(playerid,vehicleid,0);
        return 1;
    }
And you will need:
pawn Код:
stock randomEx(minnum = cellmin, maxnum = cellmax) return random(maxnum - minnum + 1) + minnum;
//Credits: ******



Re: Help with small prob - CyNiC - 30.08.2010

Sorry, i messed up.


Re: Help with small prob - FireCat - 30.08.2010

thanks [XST]O_x worked perfectly xD