How to do dis :D? - 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: How to do dis :D? (
/showthread.php?tid=535687)
How to do dis :D? -
Nojus741 - 05.09.2014
How to do so i could make like a command: /send 5 text and then it will broadcast the text to all the players 1 time every like 10 secounds until it broadcasts it 5 times.
Re: How to do dis :D? -
jueix - 05.09.2014
So you want it to send like I don't know he types /send 5 Hi. It will send the message hi every 10 seconds for 5 times after its sent the 5 time it stops? And if he types /send 112 Hi, It will send it 112 times every 10 seconds?
Re: How to do dis :D? -
Nojus741 - 05.09.2014
Quote:
Originally Posted by jueix
So you want it to send like I don't know he types /send 5 Hi. It will send the message hi every 10 seconds for 5 times after its sent the 5 time it stops? And if he types /send 112 Hi, It will send it 112 times every 10 seconds?
|
Yes i want that
Re: How to do dis :D? -
Stinged - 05.09.2014
pawn Код:
new
bCount[MAX_PLAYERS],
bTimer[MAX_PLAYERS];
public OnPlayerDisconnect(playerid, reason)
{
bCount[playerid] = 0;
KillTimer(bTimer[playerid]);
return 1;
}
CMD:send(playerid, params[])
{
new repeat, message[128];
if (sscanf(params, "is[128]", repeat, message)) return SendClientMessage(playerid, -1, "Usage: /send [repeat] [message]");
else if (repeat < 1) return SendClientMessage(playerid, -1, "Usage: /send [repeat] [message]");
bTimer[playerid] = SetTimerEx("Broadcast_Timer", 10000, true, "is", repeat, message);
return 1;
}
forward Broadcast_Timer(repeat, message[]);
public Broadcast_Timer(repeat, message[])
{
bCount[playerid]++;
SendClientMessageToAll(-1, message);
if (bCount[playerid] == repeat)
{
KillTimer(bTimer[playerid]);
}
}
Re: How to do dis :D? -
Nojus741 - 05.09.2014
Quote:
Originally Posted by Stinged
pawn Код:
new bCount[MAX_PLAYERS], bTimer[MAX_PLAYERS];
public OnPlayerDisconnect(playerid, reason) { bCount[playerid] = 0; KillTimer(bTimer[playerid]); return 1; }
CMD:send(playerid, params[]) { new repeat, message[128]; if (sscanf(params, "is[128]", repeat, message)) return SendClientMessage(playerid, -1, "Usage: /send [repeat] [message]"); else if (repeat < 1) return SendClientMessage(playerid, -1, "Usage: /send [repeat] [message]"); bTimer[playerid] = SetTimerEx("Broadcast_Timer", 10000, true, "is", repeat, message); return 1; }
forward Broadcast_Timer(repeat, message[]); public Broadcast_Timer(repeat, message[]) { bCount[playerid]++; SendClientMessageToAll(-1, message); if (bCount[playerid] == repeat) { KillTimer(bTimer[playerid]); } }
|
Thanks, i will see if this works.
Re: How to do dis :D? -
Nojus741 - 05.09.2014
Quote:
Originally Posted by Stinged
pawn Код:
new bCount[MAX_PLAYERS], bTimer[MAX_PLAYERS];
public OnPlayerDisconnect(playerid, reason) { bCount[playerid] = 0; KillTimer(bTimer[playerid]); return 1; }
CMD:send(playerid, params[]) { new repeat, message[128]; if (sscanf(params, "is[128]", repeat, message)) return SendClientMessage(playerid, -1, "Usage: /send [repeat] [message]"); else if (repeat < 1) return SendClientMessage(playerid, -1, "Usage: /send [repeat] [message]"); bTimer[playerid] = SetTimerEx("Broadcast_Timer", 10000, true, "is", repeat, message); return 1; }
forward Broadcast_Timer(repeat, message[]); public Broadcast_Timer(repeat, message[]) { bCount[playerid]++; SendClientMessageToAll(-1, message); if (bCount[playerid] == repeat) { KillTimer(bTimer[playerid]); } }
|
It doesn't work.. It just says like random parts of the message everything else works except the message..