SA-MP Forums Archive
Help with this - 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: Help with this (/showthread.php?tid=268623)



Help with this - [MKD]Max - 13.07.2011

there something name


new breakcuffsrand = random(100);



can someone tell me what that mean please so i can control all rob command please

Код:
    new breakcuffsrand = random(100);
 	if(breakcuffsrand >=26 && breakcuffsrand <=100) // Failed
	{
	new escapedname[24];
	GetPlayerName(playerid,escapedname,24);
 	SendClientMessage(playerid,COLOR_ERROR,"Escape from rope is failed try again later! Escape failed.");
    return 1;
    }
    else
    if(breakcuffsrand >=0 && breakcuffsrand <=25) // complete
	{
	TogglePlayerControllable(playerid, 1);
	isKidnapped[playerid] =0;
	new escapedname[24];
	GetPlayerName(playerid,escapedname,24);
	GameTextForPlayer(playerid,"~r~ESCAPED~n~FROM ROPE",6000,3);
	format(string, sizeof(string), "%s(%d) Has escaped from rope",escapedname,playerid);
	printf("%s",string);
	for(new i=0;i<MAX_PLAYERS;i++)
	{
    if(HasKidnapped[i] == 1) {
    format(string, sizeof(string), "%s(%d) has escaped ",escapedname,playerid);
    SendClientMessage(i,COLOR_ROYALBLUE,string);
    HasKidnapped[i]=0;



Re: Help with this - Lorenc_ - 13.07.2011

That variable contains of a value that is randomized from 0 - 100

pawn Код:
if(breakcuffsrand >=26 && breakcuffsrand <=100)
This means if the variable is between those numbers (or equal) It'll do what it said in the brackets, same with the other if statement.