SA-MP Forums Archive
Random message - 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)
+--- Thread: Random message (/showthread.php?tid=325203)



Random message - Gooday - 12.03.2012

Hello im making a simple script who gives random messages like:

i wanna make /check ID

so every 3 times it shows UNVALID

like /check ID: ----VALID
/CHECK ID --- VALID
/CHECK ID----VALID
/CHECK ID...UNVALID

I mean not always valid but sometimes it says unvalid, i just need to know how to randomize


Re: Random message - [XST]O_x - 12.03.2012

pawn Код:
if(!strcmp(cmdtext,"/check"))
{
    if(random(2) == 0) SendClientMessage(playerid, -1, "VALID");
    else SendClientMessage(playerid, -1, "UNVALID");
    return 1;
}



Re: Random message - T0pAz - 12.03.2012

Why do you want to do that?


Re: Random message - jueix - 12.03.2012

uh do somert like this

Quote:

//add to top of script
new unvalid;

//add under onplayer command.
if (strcmp("/check", cmdtext, true, 10) == 0)
{
if(unvalid[playerid] <= 2) {
unvalid = unvalid+1;
SendClientMessage(playerid, blue,"Valid");
}
else {
unvalid = 0;
SendClientMessage(playerid, red, "Unvalid");
}
return 1;
}




Re: Random message - Gooday - 12.03.2012

pawn Код:
////Frisk System
CMD:checkid(playerid, params[])
{
    new ID;
    if (sscanf(params, "u", ID)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "Usage: /Checkid [ID]");
    new playername[24];
    new string[128];
        for (new i=0;i<13;i++)
        {
        SendClientMessage(playerid, COLOR_GREY, "-------------------------------------------------------------------------------------------------");
            GetPlayerName(ID, playername,sizeof(playername));
            format(string,sizeof(string),"Name: %s ", playername);
            SendClientMessage(playerid, COLOR_GREY, string);
            if(random(8) == 0) SendClientMessage(playerid, COLOR_GREY, "License Status: VALID");
            else SendClientMessage(playerid, -1, "License Status: UNVALID");
            SendClientMessage(playerid, COLOR_GREY, "-------------------------------------------------------------------------------------------------");
        }
    return 1;
}
It spams the chat


Re: Random message - ServerScripter - 12.03.2012

Quote:
Originally Posted by T0pAz
Посмотреть сообщение
Why do you want to do that?
i think he wants to do like the example of : /engine system

if /engine ; so the engine can start or doesn't start