Raised This Month: $ Target: $400
 0% 

Newb at script :D EASY but not for me


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
BustedRider
Senior Member
Join Date: Dec 2008
Location: Canada/QC
Old 12-02-2016 , 16:43   Newb at script :D EASY but not for me
Reply With Quote #1

Hi i wanted to add random spam message into my blockbuilder plugin i saw this code... what i need exacly to do to add example 1 message and i will understand how to add more thanks
Code:
Code:
public Action:showInfo(Handle:hTimer){
	new iRandom;
	
	do{
		iRandom = GetRandomInt(1, 3);
	}
	while(g_iLastR==iRandom)

	
	if(iRandom==1 || iRandom==3)
		CPrintToChatAll("{GREEN}[NoRulez.hNs]{NORMAL}MoneyMod command:{LIGHTGREEN} !mm");
	else if(iRandom==2)
		CPrintToChatAll("{GREEN}[NoRulez.hNs]{NORMAL}Aim at the BLOCK or PLAYER and press{LIGHTGREEN} E{LIGHTGREEN} to see information");
	
	g_iLastR=iRandom;
	
	new Float:fTime = GetRandomFloat(60.0, 120.0);
	CreateTimer(fTime, showInfo);
}
__________________
BustedRider is offline
Maxximou5
AlliedModders Donor
Join Date: Feb 2013
Old 12-02-2016 , 20:25   Re: Newb at script :D EASY but not for me
Reply With Quote #2

PHP Code:
public Action:showInfo(Handle:hTimer){
    new 
iRandom;
    
    do{
        
iRandom GetRandomInt(15); // 5 is the max, increase it to add more
    
}
    while(
g_iLastR==iRandom)

    
    if(
iRandom==|| iRandom==3)
        
CPrintToChatAll("{GREEN}[NoRulez.hNs]{NORMAL}MoneyMod command:{LIGHTGREEN} !mm");
    else if(
iRandom==2)
        
CPrintToChatAll("{GREEN}[NoRulez.hNs]{NORMAL}Aim at the BLOCK or PLAYER and press{LIGHTGREEN} E{LIGHTGREEN} to see information");
    else if(
iRandom==4)
        
CPrintToChatAll("{GREEN}[NoRulez.hNs]{NORMAL}My {LIGHTGREEN}ROFLCopter {NORMAL}goes soi soi soi soi soi soi soi soi soi soi");
    else if(
iRandom==5)
        
CPrintToChatAll("{GREEN}[NoRulez.hNs]{NORMAL}My {LIGHTGREEN}ROFLCopter {NORMAL}goes soi soi soi soi soi soi soi soi soi soi");
    
    
g_iLastR=iRandom;
    
    new 
Float:fTime GetRandomFloat(60.0120.0);
    
CreateTimer(fTimeshowInfo);

Maxximou5 is offline
BustedRider
Senior Member
Join Date: Dec 2008
Location: Canada/QC
Old 12-03-2016 , 11:23   Re: Newb at script :D EASY but not for me
Reply With Quote #3

Thanks that what i tought but i just dont get the reason your do 1, 5 when its 4 announcement that show up but thanks for the code ill try that
__________________
BustedRider is offline
BustedRider
Senior Member
Join Date: Dec 2008
Location: Canada/QC
Old 12-03-2016 , 11:23   Re: Newb at script :D EASY but not for me
Reply With Quote #4

if(iRandom==1 || iRandom==3) do i need to change this? cause now there not only 3 there 4 ?
__________________
BustedRider is offline
Grey83
Veteran Member
Join Date: Dec 2014
Location: Ukraine
Old 12-03-2016 , 12:18   Re: Newb at script :D EASY but not for me
Reply With Quote #5

Maxximou5, maybe better do it in this way?
PHP Code:
public Action:showInfo(Handle:hTimer)
{
    
decl iRandom;
    
    do{
        
iRandom GetRandomInt(15); // 5 is the max, increase it to add more 
    
}
    while(
g_iLastR==iRandom)

    switch(
iRandom)
    {
        case 
13CPrintToChatAll("{GREEN}[NoRulez.hNs]{NORMAL}MoneyMod command:{LIGHTGREEN} !mm");
        case 
2CPrintToChatAll("{GREEN}[NoRulez.hNs]{NORMAL}Aim at the BLOCK or PLAYER and press{LIGHTGREEN} E{LIGHTGREEN} to see information");
        case 
4CPrintToChatAll("{GREEN}[NoRulez.hNs]{NORMAL}My {LIGHTGREEN}ROFLCopter {NORMAL}goes soi soi soi soi soi soi soi soi soi soi");
        case 
5CPrintToChatAll("{GREEN}[NoRulez.hNs]{NORMAL}My {LIGHTGREEN}ROFLCopter {NORMAL}goes soi soi soi soi soi soi soi soi soi soi");
    }

    
g_iLastR=iRandom;

    
CreateTimer(GetRandomFloat(60.0120.0), showInfo); 

__________________
Grey83 is offline
Grey83
Veteran Member
Join Date: Dec 2014
Location: Ukraine
Old 12-03-2016 , 12:21   Re: Newb at script :D EASY but not for me
Reply With Quote #6

BustedRider, why not just use this plugin?
__________________
Grey83 is offline
BustedRider
Senior Member
Join Date: Dec 2008
Location: Canada/QC
Old 12-03-2016 , 13:15   Re: Newb at script :D EASY but not for me
Reply With Quote #7

i dont understand this plugin its hard for me to understand explain in english lol but i learned html and a bit of php before but still hard
__________________
BustedRider is offline
BustedRider
Senior Member
Join Date: Dec 2008
Location: Canada/QC
Old 12-03-2016 , 13:16   Re: Newb at script :D EASY but not for me
Reply With Quote #8

but why in ur codes you put 1,3 then 2-4-5
__________________
BustedRider is offline
Grey83
Veteran Member
Join Date: Dec 2014
Location: Ukraine
Old 12-03-2016 , 13:25   Re: Newb at script :D EASY but not for me
Reply With Quote #9

Quote:
Originally Posted by BustedRider View Post
but why in ur codes you put 1,3 then 2-4-5
Bkz
__________________
Grey83 is offline
Maxximou5
AlliedModders Donor
Join Date: Feb 2013
Old 12-03-2016 , 15:26   Re: Newb at script :D EASY but not for me
Reply With Quote #10

Quote:
Originally Posted by Grey83 View Post
Maxximou5, maybe better do it in this way?
It would be indeed; however, he didn't ask for that level of assistance.
Might as well do the new syntax if you're going the extra mile.
Quote:
Originally Posted by BustedRider View Post
but why in ur codes you put 1,3 then 2-4-5
That's the way the code you gave was before, adding in more numbers gives it a better chance of being selected.
Maxximou5 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 22:01.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode