Simple Advertisement system (SSCANF, ZCMD) -
FalconWingsX - 08.06.2013
I were to share a simple way to create an advertisement system which allows you to post an advertisement only every 60 seconds.
Place this on top of the script
pawn Code:
new ServerAdvert;
// COLOR
#define COLOR_LIME 0x10F441AA
Now for the actual Command.
pawn Code:
CMD:advertisement(playerid, params[])
{
new string[128], name[64] ;
GetPlayerName(playerid, name, sizeof(name));
if(PlayerInfo[playerid][Level] < 1) return SendClientMessage(playerid, COLOR_GRAY, "You need to be level 2 to advertise!");
if(sscanf(params, "s[128]", params)) return SendClientMessage(playerid, COLOR_GRAY, "USAGE: /ad(vertisement) [Text]");
if(ServerAdvert == 1)
{
SendClientMessage(playerid, COLOR_RED, "Only one advertisement every 60 seconds!");
}
else
{
ServerAdvert = 1;
format(string, sizeof(string), "[Advertisement] %s Contact: %s Ph: %d", params, name(playerid), PlayerInfo[playerid][Phone]);
SendClientMessageToAll(COLOR_LIME, string);
SetTimer("AdTimer", 60000, false);
GivePlayerMoney(playerid, -1000);
}
return 1;
}
Now for the timer to limit the amount of advertisements placed.
pawn Code:
public AdTimer()
{
ServerAdvert = 0;
return 1;
}
You can use your own function to get the Underscore from the name.
Re: Simple Advertisement system (SSCANF, ZCMD) -
Vince - 08.06.2013
Place this, place this, place this. Hardly anything explained. Besides that you imply that everyone uses
PlayerInfo with the variables
pLevel and
Phone.
Re: Simple Advertisement system (SSCANF, ZCMD) -
Red_Dragon. - 08.06.2013
This isn't a tutorial at all. A tutorial must have EVERY single thing explained in an appropriate way which you don't show at all. Also you use variables which you obligate that each person should use.
Re: Simple Advertisement system (SSCANF, ZCMD) -
GuilhermeNunes - 13.07.2017
Good tutorial for anyone who has a basic notion Dr. Pawn but bad for the beginners lacked explanation + REPUTATION
Re: Simple Advertisement system (SSCANF, ZCMD) -
iLearner - 13.07.2017
Its a snippet of your script that you copy pasted.
Re: Simple Advertisement system (SSCANF, ZCMD) -
saffierr - 13.07.2017
Try to explain the code piece by piece, elaborate what it does/means.
Re: Simple Advertisement system (SSCANF, ZCMD) -
Kane - 13.07.2017
Bumping a tutorial from 2013 and telling the OP to explain it. Why?
Re: Simple Advertisement system (SSCANF, ZCMD) -
Eoussama - 13.07.2017
Working with a variable such ServerAdvert will only allow one advertisement in 60 seconds per players, meaning, if someone has already used the command, other players must wait for 60 before advertising, why not make it a player variable instead?
And why did you type this /ad(vertisement) if you are not going to demonstrate the creation of the /ad alias?
Re: Simple Advertisement system (SSCANF, ZCMD) -
iLearner - 13.07.2017
Quote:
Originally Posted by Arthur Kane
Bumping a tutorial from 2013 and telling the OP to explain it. Why?
|
OK, haha didn't notice that. apologies.