09.10.2009, 13:51
Hi. How to make random teleport?
Originally Posted by martyz-lithuania
Hi. How to make random teleport?
|
new Float:RandomTeleport[3][3] =
{
{600.1861, -984.6816, 8.5846},
{466.4644, 484.0000, 5.000},
{846.5465, 687.6843, 7.5416}
};
new randomTele = random(sizeof(RandomTeleport));
SetPlayerPos(playerid, RandomTeleport[randomTele][0], RandomTeleport[randomTele][1], RandomTeleport[randomTele][2]);
//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
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.
Originally Posted by Enemy_Plus[SA:MP
]
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;
}
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