12.01.2010, 20:54
I want to make a command that spawns randomly, how can i make it?
new Float:RandomSpawns[4][3] = {
{1253.6213,368.9244,19.5614}, //Change if you wish to.
{1263.1244,369.7004,19.5547}, //Change if you wish to.
{1246.1509,368.8576,19.5547}, //Change if you wish to.
{1256.1157,364.1463,19.5614} //Change if you wish to.
};
if(strcmp(cmdtext, "/rspawn", true) == 0) // Change if you wish to.
{
new rand = random(sizeof(RandomSpawns));
SetPlayerPos(playerid, RandomSpawns[rand][0], RandomSpawns[rand][1], RandomSpawns[rand][2]);
}
Originally Posted by Stah™
Spawns what randomly?
|
Originally Posted by Stah™
pawn Code:
pawn Code:
|
Originally Posted by Fedee!
Oh, I forgot, also I need to give him a weapon, example, he tipes /dm and gives weapons and random spawns.
|
if(strcmp(cmdtext, "/rspawn", true) == 0) { new rand = random(sizeof(RandomSpawns)); SetPlayerPos(playerid, RandomSpawns[rand][0], RandomSpawns[rand][1], RandomSpawns[rand][2]); SafeGivePlayerWeapon(playerid, 3, 1); SafeGivePlayerWeapon(playerid, 3, 1); }
Originally Posted by Peep
Quote:
Code:
if(strcmp(cmdtext, "/rspawn", true) == 0) { new rand = random(sizeof(RandomSpawns)); SetPlayerPos(playerid, RandomSpawns[rand][0], RandomSpawns[rand][1], RandomSpawns[rand][2]); SafeGivePlayerWeapon(playerid, 3, 1); SafeGivePlayerWeapon(playerid, 3, 1); } |
C:\Documents and Settings\Feche!\Escritorio\Server SAMP\gamemodes\freeroam.pwn(1167) : error 017: undefined symbol "SafeGivePlayerWeapon" |
if(strcmp(cmdtext, "/rspawn", true) == 0) { new rand = random(sizeof(RandomSpawns)); SetPlayerPos(playerid, RandomSpawns[rand][0], RandomSpawns[rand][1], RandomSpawns[rand][2]); GivePlayerWeapon(playerid, 3, 1); }
Originally Posted by timmehhh
Code:
if(strcmp(cmdtext, "/rspawn", true) == 0) { new rand = random(sizeof(RandomSpawns)); SetPlayerPos(playerid, RandomSpawns[rand][0], RandomSpawns[rand][1], RandomSpawns[rand][2]); GivePlayerWeapon(playerid, 3, 1); } |