SA-MP Forums Archive
This goes to work? - 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: This goes to work? (/showthread.php?tid=138289)



This goes to work? - Sergio_team - 01.04.2010

Hi, im doing a public for my gm of racing, of in every race the player goes to have 1/901 to get an object, this goes to work?

Код:
new RandStart = random(901);
  if(IsPlayerConnected(playerid))
  {
  		switch(RandStart)
    {
		  	case 0:
		  	{
		  	  AddItem(playerid,"Maximos_Embargos",1);
		  	  return 1;
		  	}
		  	case 1..900:
		  	{
		  	return 1;
		  	}
		}
	}
return 1
because when i compile if i put the random 900 or less don't give me a warning, and when i put more of 900 don't give me a warning.


Re: This goes to work? - [cA]Unforseen - 01.04.2010

its not public :O
and the return :OOOOOOOO

it should be return 1; not return 1
so dont steal scripts...


Re: This goes to work? - RSX - 01.04.2010

why aren't you just using if(RandStart) (same as ==1) and no returns? except for last one.


Re: This goes to work? - Sergio_team - 01.04.2010

Quote:
Originally Posted by RSX
why aren't you just using if(RandStart) (same as ==1) and no returns? except for last one.
Код:
ok, i go to use if(RandStart == 0)
{

}
if(RandStart == 1..900)
{

}
this its okey no?


---
And the return 1 i writed in here, but i have writed good the return 1; in my gm xD

SOLVED
public DarObjetos(playerid)
{
new RandStart = random(901);
if(IsPlayerConnected(playerid))
{
if(RandStart == 0)
{
AddItem(playerid,"Maximos_Embargos",1);
}
if(RandStart >= 1 && RandStart <= 900)
{

}
}
return 1;
}