Need advertisement script ! - 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: Need advertisement script ! (
/showthread.php?tid=83353)
Need advertisement script ! -
MuMiJa - 24.06.2009
I need advertisement script like in RP. can who help me ?
THANK YOU VERY MUCH!
Re: Need advertisement script ! -
radi - 24.06.2009
this helps ?
pawn Код:
forward RandomAnnounce();
and
pawn Код:
new RandomText[5][0] = { // where the 5 is edit this to the number of the random text
{"hello"},
{"hello"},
{"hello"},
{"hello"},
{"hello"} // the last one with out a ,
};
and this at ongamemodeinit
pawn Код:
SetTimer("RandomAnnounce", 180000, true); // 3 Minutes
Re: Need advertisement script ! -
MuMiJa - 24.06.2009
Quote:
Originally Posted by radi
this helps ?
pawn Код:
forward RandomAnnounce();
and
pawn Код:
new RandomText[5][0] = { // where the 5 is edit this to the number of the random text {"hello"}, {"hello"}, {"hello"}, {"hello"}, {"hello"} // the last one with out a , };
and this at ongamemodeinit
pawn Код:
SetTimer("RandomAnnounce", 180000, true); // 3 Minutes
|
this...
command: /ad
like this
http://forum.sa-mp.com/index.php?topic=71698.0
but I cant edit this for my GM
Re: Need advertisement script ! -
radi - 24.06.2009
this is a message that every time appears
if you set it on 3 min
every 3 min it will apears
it wil randomly pick a line of what you typed
Re: Need advertisement script ! -
radi - 24.06.2009
or like this ?
pawn Код:
if(strcmp(cmd, "/advertise", true) == 0 || strcmp(cmd, "/ad", true) == 0)
{
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_PURPLE, "USAGE: (/ad)vertise [advert text]");
return 1;
}
if ((noooc) && (PlayerInfo[playerid][pAdmin] < 1))
{
SendClientMessage(playerid, COLOR_PURPLE, " the advertisment chanel has been disabled by admin");
return 1;
}
if ((!adds) && (PlayerInfo[playerid][pAdmin] < 1))
{
format(string, sizeof(string), " Please try again later %d seconds between adverts", (addtimer/1000));
SendClientMessage(playerid, COLOR_PURPLE, string);
return 1;
}
if(Mute[playerid] == 0)
{
format(string, sizeof(string), "Advertisement: %s, Contact: %s Ph: %d", result, sendername,PlayerInfo[playerid][pPnumber]);
OOCOff(TEAM_GROVE_COLOR,string);
}
else
{
SendClientMessage(playerid, COLOR_RED, "You cannot use /ad if you're muted.");
}
if (PlayerInfo[playerid][pAdmin] < 1)
{
SetTimer("AddsOn", addtimer, 0);
adds = 0;
}
return 1;
}
?
Re: Need advertisement script ! -
MenaceX^ - 24.06.2009
Quote:
Originally Posted by radi
or like this ?
pawn Код:
if(strcmp(cmd, "/advertise", true) == 0 || strcmp(cmd, "/ad", true) == 0) { GetPlayerName(playerid, sendername, sizeof(sendername)); new length = strlen(cmdtext); while ((idx < length) && (cmdtext[idx] <= ' ')) { idx++; } new offset = idx; new result[64]; while ((idx < length) && ((idx - offset) < (sizeof(result) - 1))) { result[idx - offset] = cmdtext[idx]; idx++; } result[idx - offset] = EOS; if(!strlen(result)) { SendClientMessage(playerid, COLOR_PURPLE, "USAGE: (/ad)vertise [advert text]"); return 1; } if ((noooc) && (PlayerInfo[playerid][pAdmin] < 1)) { SendClientMessage(playerid, COLOR_PURPLE, " the advertisment chanel has been disabled by admin"); return 1; } if ((!adds) && (PlayerInfo[playerid][pAdmin] < 1)) { format(string, sizeof(string), " Please try again later %d seconds between adverts", (addtimer/1000)); SendClientMessage(playerid, COLOR_PURPLE, string); return 1;
} if(Mute[playerid] == 0) { format(string, sizeof(string), "Advertisement: %s, Contact: %s Ph: %d", result, sendername,PlayerInfo[playerid][pPnumber]); OOCOff(TEAM_GROVE_COLOR,string); } else { SendClientMessage(playerid, COLOR_RED, "You cannot use /ad if you're muted."); } if (PlayerInfo[playerid][pAdmin] < 1) { SetTimer("AddsOn", addtimer, 0); adds = 0; } return 1; }
?
|
Easy to copy from the GF.
Re: Need advertisement script ! -
MuMiJa - 24.06.2009
Quote:
Originally Posted by MenaceX^
Quote:
Originally Posted by radi
or like this ?
pawn Код:
if(strcmp(cmd, "/advertise", true) == 0 || strcmp(cmd, "/ad", true) == 0) { GetPlayerName(playerid, sendername, sizeof(sendername)); new length = strlen(cmdtext); while ((idx < length) && (cmdtext[idx] <= ' ')) { idx++; } new offset = idx; new result[64]; while ((idx < length) && ((idx - offset) < (sizeof(result) - 1))) { result[idx - offset] = cmdtext[idx]; idx++; } result[idx - offset] = EOS; if(!strlen(result)) { SendClientMessage(playerid, COLOR_PURPLE, "USAGE: (/ad)vertise [advert text]"); return 1; } if ((noooc) && (PlayerInfo[playerid][pAdmin] < 1)) { SendClientMessage(playerid, COLOR_PURPLE, " the advertisment chanel has been disabled by admin"); return 1; } if ((!adds) && (PlayerInfo[playerid][pAdmin] < 1)) { format(string, sizeof(string), " Please try again later %d seconds between adverts", (addtimer/1000)); SendClientMessage(playerid, COLOR_PURPLE, string); return 1;
} if(Mute[playerid] == 0) { format(string, sizeof(string), "Advertisement: %s, Contact: %s Ph: %d", result, sendername,PlayerInfo[playerid][pPnumber]); OOCOff(TEAM_GROVE_COLOR,string); } else { SendClientMessage(playerid, COLOR_RED, "You cannot use /ad if you're muted."); } if (PlayerInfo[playerid][pAdmin] < 1) { SetTimer("AddsOn", addtimer, 0); adds = 0; } return 1; }
?
|
Easy to copy from the GF.
|
Yes This I need.. but I get an errors
Код:
C:\Documents and Settings\Metka\My Documents\samp-server\gamemodes\GM.pwn(13170) : warning 217: loose indentation
C:\Documents and Settings\Metka\My Documents\samp-server\gamemodes\GM.pwn(13170) : error 017: undefined symbol "cmd"
C:\Documents and Settings\Metka\My Documents\samp-server\gamemodes\GM.pwn(13172) : error 017: undefined symbol "sendername"
C:\Documents and Settings\Metka\My Documents\samp-server\gamemodes\GM.pwn(13172) : error 017: undefined symbol "sendername"
C:\Documents and Settings\Metka\My Documents\samp-server\gamemodes\GM.pwn(13172) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Metka\My Documents\samp-server\gamemodes\GM.pwn(13172) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
5 Errors.
Re: Need advertisement script ! -
NigNog1 - 24.06.2009
An example using dcmd:
Код:
dcmd_ad( playerid, params[ ] )
{
if( !strlen ( params ) )
return SendClientMessage ( playerid, 0xFFFFFFAA, "Syntax: /ad [advertisement]" );
if( strlen( params ) < 2 )
return SendClientMessage( playerid, 0xFFFFFFAA, "Your advertisement is not long enough." );
new szAdMsg[128];
format( szAdMsg, 128, "Advertisement: %s", params );
SendClientMessageToAll( 0xFFFFFFAA, szAdMsg );
return 1;
}
For more information about dcmd visit
https://sampwiki.blast.hk/wiki/Dcmd