Command Help
#1

How can i set a timer for 60 seconds
PHP код:
CMD:ad(playeridparams[])
{
    new 
string[128];
    if(
gPlayerLogged{playerid} == 0)
    {
        
SendClientMessageEx(playeridCOLOR_GREY"You're not logged in.");
        return 
1;
    }
    if(
PlayerInfo[playerid][pADMute] == 1)
    {
        
SendClientMessageEx(playeridCOLOR_GREY"You are muted from advertisements.");
        return 
1;
    }
    if(
PlayerInfo[playerid][pPnumber] == 0)
    {
        
SendClientMessageEx(playeridCOLOR_GRAD2"You don't have a cell phone.");
        return 
1;
    }
    if(!
IsPlayerInRangeOfPoint(playerid5646.549377, -1348.27233813.546875) && !IsPlayerInRangeOfPoint(playerid5, -2240.405761239.21240235.320312))
    {
        
SendClientMessageEx(playeridCOLOR_GRAD2"You can only put up advertisements at ad points (Rodeo in Los Santos or Garcia in San Fierro).");
        return 
1;
    }
    if(
GetPVarInt(playerid"Injured") == 1) return SendClientMessageEx(playeridCOLOR_GREY"You can't place advertisements while injured.");
    if(
PlayerCuffed[playerid] != 0) return SendClientMessageEx(playeridCOLOR_GREY"You can't place advertisements right now.");
    if(
PlayerInfo[playerid][pJailTime] > 0) return SendClientMessageEx(playeridCOLOR_GREY"You can't place advertisements while in jail.");
    if(
isnull(params))
    {
        
SendClientMessageEx(playeridCOLOR_GRAD2"USAGE: (/ad)vertise [advert text]");
        return 
1;
    }
    if(
strlen(params) >= 66 )
    {
        
SendClientMessageExplayeridCOLOR_GRAD1"Your advertisement was too long, please refrain from using more than 66 characters in an advertisement." );
        return 
1;
    }
    if ((!
adds) && (PlayerInfo[playerid][pAdmin] < 2))
    {
        
SendClientMessageEx(playeridCOLOR_GRAD2"Please try again later - only one advertisement can be submitted every 30 seconds.");
        return 
1;
    }
    new 
payout strlen(params) * 25;
    if(
GetPlayerCash(playerid) < payout)
    {
        
format(stringsizeof(string), "* You used %d characters which cost $%d, you don't have enough."strlen(params), payout);
        
SendClientMessageEx(playeridCOLOR_LIGHTBLUEstring);
        return 
1;
    }
    
format(stringsizeof(string), "~r~Paid $%d~n~~w~Message contained: %d Characters"payoutstrlen(params));
    
GameTextForPlayer(playeridstring50005);
    if (
PlayerInfo[playerid][pAdmin] < 2){SetTimer("AddsOn"addtimer0);adds 0;}
    
GivePlayerCash(playerid, - payout);
    
format(stringsizeof(string), "Advertisement: %s - contact %s (%d)",  paramsGetPlayerNameEx(playerid),PlayerInfo[playerid][pPnumber]);
    
OOCNews(TEAM_GROVE_COLOR,string);
    if(!
newspaperad1[0])
    {
        
newspaperad1 string;
    }
    else if(!
newspaperad2[0])
    {
        
newspaperad2 string;
    }
    else if(!
newspaperad3[0])
    {
        
newspaperad3 string;
    }
    else if(!
newspaperad4[0])
    {
        
newspaperad4 string;
    }
    else if(!
newspaperad5[0])
    {
        
newspaperad5 string;
    }
    else
    {
        
newspaperad1 newspaperad2;
        
newspaperad2 newspaperad3;
        
newspaperad3 newspaperad4;
        
newspaperad4 newspaperad5;
        
newspaperad5 string;
    }
    return 
1;

Reply
#2

like this
Reply
#3

i need help, ASAP.
Reply
#4

Quote:
Originally Posted by Tanush123
Посмотреть сообщение
like this
Can you fix it for me please?
Reply
#5

dude just read
https://sampwiki.blast.hk/wiki/SetTimerEx

If you try it and it still doesn't work, post the code with the timer on it and ask how to fix it
Reply
#6

Quote:
Originally Posted by Tanush123
Посмотреть сообщение
dude just read
https://sampwiki.blast.hk/wiki/SetTimerEx

If you try it and it still doesn't work, post the code with the timer on it and ask how to fix it
Not Working.
PHP код:
CMD:ad(playeridparams[])
{
    new 
string[128];
    if(
gPlayerLogged{playerid} == 0)
    {
        
SendClientMessageEx(playeridCOLOR_GREY"You're not logged in.");
        return 
1;
    }
    if(
PlayerInfo[playerid][pADMute] == 1)
    {
        
SendClientMessageEx(playeridCOLOR_GREY"You are muted from advertisements.");
        return 
1;
    }
    if(
PlayerInfo[playerid][pPnumber] == 0)
    {
        
SendClientMessageEx(playeridCOLOR_GRAD2"You don't have a cell phone.");
        return 
1;
    }
    if(
GetPVarInt(playerid"Injured") == 1) return SendClientMessageEx(playeridCOLOR_GREY"You can't place advertisements while injured.");
    if(
PlayerCuffed[playerid] != 0) return SendClientMessageEx(playeridCOLOR_GREY"You can't place advertisements right now.");
    if(
PlayerInfo[playerid][pJailTime] > 0) return SendClientMessageEx(playeridCOLOR_GREY"You can't place advertisements while in jail.");
    if(
isnull(params))
    {
        
SendClientMessageEx(playeridCOLOR_GRAD2"USAGE: (/ad)vertise [advert text]");
        return 
1;
    }
    if(
strlen(params) >= 66 )
    {
        
SendClientMessageExplayeridCOLOR_GRAD1"Your advertisement was too long, please refrain from using more than 66 characters in an advertisement." );
        return 
1;
    }
    if ((!
adds) && (PlayerInfo[playerid][pAdmin] < 2))
    {
        
SendClientMessageEx(playeridCOLOR_GRAD2"Please try again later - only one advertisement can be submitted every 30 seconds.");
        return 
1;
    }
    new 
payout strlen(params) * 25;
    if(
GetPlayerCash(playerid) < payout)
    {
        
format(stringsizeof(string), "* You used %d characters which cost $%d, you don't have enough."strlen(params), payout);
        
SendClientMessageEx(playeridCOLOR_LIGHTBLUEstring);
        return 
1;
    }
    
format(stringsizeof(string), "~r~Paid $%d~n~~w~Message contained: %d Characters"payoutstrlen(params));
    
GameTextForPlayer(playeridstring50005);
    if (
PlayerInfo[playerid][pAdmin] < 2)
    
SetTimerEx("AddsOn"addtimer60);adds 0;
    
GivePlayerCash(playerid, - payout);
    
format(stringsizeof(string), "Ad: %s - %s PH(%d)",  paramsGetPlayerNameEx(playerid),PlayerInfo[playerid][pPnumber]);
    
OOCNews(TEAM_GROVE_COLOR,string);
    if(!
newspaperad1[0])
    {
        
newspaperad1 string;
    }
    else if(!
newspaperad2[0])
    {
        
newspaperad2 string;
    }
    else if(!
newspaperad3[0])
    {
        
newspaperad3 string;
    }
    else if(!
newspaperad4[0])
    {
        
newspaperad4 string;
    }
    else if(!
newspaperad5[0])
    {
        
newspaperad5 string;
    }
    else
    {
        
newspaperad1 newspaperad2;
        
newspaperad2 newspaperad3;
        
newspaperad3 newspaperad4;
        
newspaperad4 newspaperad5;
        
newspaperad5 string;
    }
    return 
1;

PHP код:
C:\Documents and Settings\Mark&Matt\My Documents\Next Revolution Roleplay\Next Revolution Roleplay\gamemodes\NRRP_Fixed.pwn(50219) : warning 202number of arguments does not match definition
Pawn compiler 3.2.3664              Copyright 
(c1997-2006ITB CompuPhase
1 Warning

Reply
#7

How to fix it? response please
Reply
#8

pawn Код:
SetTimer("addon",60000,false);
under your script add
pawn Код:
forward addon();
public addon()
{
   adds = 0;
   return 1;
}
not sure if it will work
Reply
#9

Quote:
Originally Posted by Tanush123
Посмотреть сообщение
pawn Код:
SetTimer("addon",60000,false);
under your script add
pawn Код:
forward addon();
public addon()
{
   adds = 0;
   return 1;
}
not sure if it will work
Not working. Can you fix the whole code for me please?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)