Random teleport
#1

Hi. How to make random teleport?
Reply
#2

Quote:
Originally Posted by martyz-lithuania
Hi. How to make random teleport?
What you mean?, Give some more infomation.
Reply
#3

if i type /teleport (1 command) i need to teleport to 600.1861, -984.6816, 8.5846 or 466.4644, 484.0000, 5.000 or 846.5465, 687.6843, 7.5416
i need teleport to random place.
Reply
#4

Try this:

pawn Код:
new Float:RandomTeleport[3][3] =
{
{600.1861, -984.6816, 8.5846},
{466.4644, 484.0000, 5.000},
{846.5465, 687.6843, 7.5416}
};
Add this to your /teleport command:
pawn Код:
new randomTele = random(sizeof(RandomTeleport));
SetPlayerPos(playerid, RandomTeleport[randomTele][0], RandomTeleport[randomTele][1], RandomTeleport[randomTele][2]);
Reply
#5

pawn Код:
//under your command:

new RandomTP = Random(3);//Defines the variable into how many randoms(case)
switch(RandomTP)//tells server to make the next lot of case's to be selected at random
{//opens a new level (needs to be indented)
case 0: SetPlayerPos(playerid,600.1861, -984.6816, 8.5846);// starts at case 0 because thats how it reads it 0 - infinity
case 1: SetPlayerPos(playerid,466.4644, 484.0000, 5.000);
case 2: SetPlayerPos(playerid,846.5465, 687.6843, 7.5416);
}// closes a level (needs to be indented)
//thats it
Reply
#6

Код:
D:\mta\samp\SAMP\stunt servas\gamemodes\LithuanianStunts.pwn(801) : error 003: declaration of a local variable must appear in a compound block
D:\mta\samp\SAMP\stunt servas\gamemodes\LithuanianStunts.pwn(801) : error 017: undefined symbol "RandomTP"
D:\mta\samp\SAMP\stunt servas\gamemodes\LithuanianStunts.pwn(801) : error 017: undefined symbol "Random"
D:\mta\samp\SAMP\stunt servas\gamemodes\LithuanianStunts.pwn(801) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Reply
#7

Quote:
Originally Posted by Enemy_Plus[SA:MP
]
pawn Код:
new RandomTP = Random(3);
The function's name is random, not Random.
Reply
#8

and for all again, who cant fix the code by hisself + indentation

pawn Код:
switch(random(3))
    {
        case 0: SetPlayerPos(playerid, 600.1861, -984.6816, 8.5846);
        case 1: SetPlayerPos(playerid, 466.4644, 484.0000, 5.000);
        case 2: SetPlayerPos(playerid, 846.5465, 687.6843, 7.5416);
        default: return 0;
    }
Reply
#9

ye. thanks but..:
Код:
D:\mta\samp\SAMP\stunt servas\gamemodes\LithuanianStunts.pwn(801) : error 003: declaration of a local variable must appear in a compound block
D:\mta\samp\SAMP\stunt servas\gamemodes\LithuanianStunts.pwn(801) : error 017: undefined symbol "RandomTP"
D:\mta\samp\SAMP\stunt servas\gamemodes\LithuanianStunts.pwn(802) : error 017: undefined symbol "RandomTP"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Errors.
Код:
	new RandomTP = random(3); //801
	switch(RandomTP) //802
Reply
#10

Help me someone?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)