SA-MP Forums Archive
How can i? - 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: How can i? (/showthread.php?tid=172467)



How can i? - FireCat - 30.08.2010

hi, i was thiking i just made a new stunt place in my server and when they teleport i want it to teleport to 3 random place but its confusing i dont quite catch how? well i can give you the positions but i only want it to random when they are in the car so in resum when they teleport to this place i only want the teleport random 3 places if they are in the car

Код:
AddPlayerClass(122,2000.0122,-2656.5027,13.5469,352.2979,0,0,0,0,0,0); // stunt3
AddPlayerClass(122,1973.4526,-2656.2195,13.5469,1.4669,0,0,0,0,0,0); // stunt3
AddPlayerClass(122,1979.8668,-2655.1372,13.5469,1.4669,0,0,0,0,0,0); // stunt3
AddPlayerClass(122,1985.8344,-2655.0415,13.5469,1.1890,0,0,0,0,0,0); // stunt3
Код:
if(!strcmp(cmdtext, "/stunt3", true))
{
	    if(IsPlayerInAnyVehicle(playerid)) SetVehiclePos(GetPlayerVehicleID(playerid), 562.7345,2442.1843,192.0527);
        else SetPlayerPos(playerid, 562.7345,2442.1843,192.0527);
    	SendClientMessage(playerid,COLOR_GREEN, "Welcome to stunt3");
    	return 1;

}
well can anyone help meh?
_______________________
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: How can i? - Arrows73 - 30.08.2010

Well I dont understand exactly what you mean, but possibly sth like this:

Код:
if(!strcmp(cmdtext, "/stunt3", true))
{
	    if(IsPlayerInAnyVehicle(playerid)) 
{
new Random = random(3);
if (Random == 0) { SetVehiclePos(GetPlayerVehicleID(playerid), 562.7345,2442.1843,192.0527);  }
else if (Random == 1) { SetVehiclePos(GetPlayerVehicleID(playerid), 562.7345,2442.1843,192.0527);  }
else { SetVehiclePos(GetPlayerVehicleID(playerid), 562.7345,2442.1843,192.0527);  }
}
        else SetPlayerPos(playerid, 562.7345,2442.1843,192.0527);
    	SendClientMessage(playerid,COLOR_GREEN, "Welcome to stunt3");
    	return 1;

}



Re: How can i? - [XST]O_x - 30.08.2010

pawn Код:
new Float:RandStunt[][3] = {
{2000.0122,-2656.5027,13.5469},
{1973.4526,-2656.2195,13.5469},
{1979.8668,-2655.1372,13.5469},
{1985.8344,-2655.0415,13.5469}};

if(strcmp(cmdtext,"/stunt3",true) == 0)
{
    new rand2 = random(sizeof(RandStunt));
    if(IsPlayerInAnyVehicle(playerid))
    {
        SetVehiclePos(GetPlayerVehicleID(playerid),RandStunt[rand2][0],RandStunt[rand2][1],RandStunt[rand2][2]);
     }
     else
     {
         SetPlayerPos(playerid,RandStunt[rand2][0],RandStunt[rand2][1],RandStunt[rand2][2]);
     }
     return 1;
}
Easier and faster way.


Re: How can i? - FireCat - 30.08.2010

thanks xst