SA-MP Forums Archive
/ad system - 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: /ad system (/showthread.php?tid=626107)



/ad system - 025Tadija - 10.01.2017

Hey there. I am making simple advertisement system, which allows you to place an advert and let everyone see it like

Usage: /ad [Advertisement text]

Ad system works like this, you write /ad I am selling my house in Ganton, call or sms.
Script will show this

[Advertisement] I am selling my house in Ganton, call or sms, Phone:[2223331]

As we can see there is no FirstName_SureName. I want to create commnd which will allow an admin to see LAST 5 adverts and FirstName_SureName who send them, because otherwise everyone can write whatever they want and not being punished for it because admin cannot see who actually posted it.

I need command which allow me to see last 5 adverts like this:

you type /lastads

"FirstName_Surename placed: "I am selling my house in Ganton, call or sms."

pawn Код:
CMD:ad(playerid, params[])
{
    if(isnull(params))
        return SendClientMessage(playerid, COLOR_LIGHTRED, "(( Koristenje: /ad [advertisement text] ))");
       
    if(strlen(params) > 64)
    {
        va_SendClientMessageToAll(COLOR_GREEN, "[Advertisement] %.64s ...", params);
        va_SendClientMessageToAll(COLOR_GREEN, "... %s, phone[%d]", params[64], PlayerInfo[playerid][pNumber]);
    }
   
    else
        va_SendClientMessageToAll(COLOR_GREEN, "[Advertisement] %s, phone[%d]", params, PlayerInfo[playerid][pNumber]);
       

    return 1;
}
That is my /ad command, I am aware that I have to create fuction which will save that advert and later reveal it under /lastad command.