Help me, i have a bug script... -
Kazuo - 17.05.2012
1.) Why do I type the command /ad always had to wait 60 seconds, and it always comes up .. so I can not use /ad
pawn Код:
if(strcmp(cmd, "/advertise", true) == 0 || strcmp(cmd, "/ad", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(gPlayerLogged[playerid] == 0)
{
SendClientMessage(playerid, COLOR_LIGHTRED,"ERROR: You havent logged in yet!");
return true;
}
if(!PlayerToPoint(5.0, playerid, 1737.4242,-1270.6655,13.5446))
{
SendClientMessage(playerid, COLOR_LIGHTRED, "ERROR: You need to be near the Advertisement Business.");
return true;
}
if(Advertisement==1)
{
SendClientMessage(playerid,COLOR_LIGHTRED, "ERROR: You have to wait atleast 60 seconds before advertise again");
return true;
}
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[256];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "DEBUG: (/ad)vertise [advert text]");
return true;
}
if ((!adds) && (Account[playerid][pAdmin] < 1))
{
format(string, sizeof(string), " Please try again later %d seconds between Advertisements !", (addtimer/1000));
SendClientMessage(playerid, COLOR_GRAD2, string);
return true;
}
if(GetPlayerMoney(playerid) < 150)
{
SendClientMessage(playerid, COLOR_GREY, " You don't have enough money to advertise !");
return true;
}
GiveMoney(playerid, - 150);
if(Account[playerid][pPnumber] != 0)
{
format(string, sizeof(string), "Advertisement: %s, Contact: %s Phone: %d", result, Account[playerid][pName],Account[playerid][pPnumber]);
}
else
{
format(string, sizeof(string), "Advertisement: %s, Contact: %s", result, Account[playerid][pName]);
}
OOCNews(TEAM_GROVE_COLOR,string);
Advertisement=1;
SetTimerEx("EnableAdd",60000,false,"d",playerid);
}
return true;
}
2.) The second time I use the command, always says "ERROR: Command not found, please type an existing command." but the command is working and can be used
pawn Код:
else if(strcmp(x_v,"pickup",true)==0)
{
if(Mobile[playerid] != 255)
{
SendClientMessage(playerid, COLOR_LIGHTRED, "ERROR: You are already on a call...");
return 1;
}
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(Mobile[i] == playerid)
{
Mobile[playerid] = i; //caller connecting
SendClientMessage(i, COLOR_WHITE, "PHONE: Call picked up.");
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s answers his cellphone.", sendername);
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USECELLPHONE);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
RingTone[playerid] = 0;
}
}
}
}
3.) when I use the command /stats, and I've joined the Faction. and by the time I /stats do not appear like the following information about Faction
pawn Код:
if(Account[targetid][pMember] != 0)
{
format(coordsstring, sizeof(coordsstring), "Faction Name <%s> | Faction Rank <%s>",ttext, rtext);
SendClientMessage(playerid, COLOR_WHITE,coordsstring);
}
if anyone can help me?
Re: Help me, i have a bug script... -
Kazuo - 17.05.2012
is there anyone who wants to help?
The advertisement is fixed
Re: Help me, i have a bug script... -
RedWingz - 17.05.2012
Try this:
pawn Код:
else if(strcmp(cmd, "pickup", true) == 0)
{
if(Mobile[playerid] != 255)
{
SendClientMessage(playerid, COLOR_LIGHTRED, "ERROR: You are already on a call...");
return 1;
}
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(Mobile[i] == playerid)
{
Mobile[playerid] = i; //caller connecting
SendClientMessage(i, COLOR_WHITE, "PHONE: Call picked up.");
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s answers his cellphone.", sendername);
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USECELLPHONE);
ProxDetector(30.0, playerid, string,
RingTone[playerid] = 0;
}
}
}
}
I've never tried this script, As in Mobiles.
But obviously, My try up above might be wrong but...
Good luck if that doesn't work out.
Re: Help me, i have a bug script... -
Kazuo - 17.05.2012
no-no .. any total, even command can not be in use at all .. please help me
Re: Help me, i have a bug script... -
TzAkS. - 17.05.2012
From /ad remove
Код:
if(Advertisement==1)
{
SendClientMessage(playerid,COLOR_LIGHTRED, "ERROR: You have to wait atleast 60 seconds before advertise again");
return true;
}
And
Код:
if ((!adds) && (Account[playerid][pAdmin] < 1))
{
format(string, sizeof(string), " Please try again later %d seconds between Advertisements !", (addtimer/1000));
SendClientMessage(playerid, COLOR_GRAD2, string);
return true;
}
To stats how did you created ttext, rtext ?
-
Kazuo - 17.05.2012
The stats i use
pawn Код:
else if(Account[targetid][pMember] == 1 || Account[targetid][pLeader] == 1)//PD Ranks
{
if(Account[targetid][pRank] == 1) { rtext = "Cadet"; }
else if(Account[targetid][pRank] == 2) { rtext = "Police Officer I"; }
else if(Account[targetid][pRank] == 3) { rtext = "Police Officer II"; }
else if(Account[targetid][pRank] == 4) { rtext = "Lead Officer"; }
else if(Account[targetid][pRank] == 5) { rtext = "Senior Lead Officer"; }
else if(Account[targetid][pRank] == 6) { rtext = "Sergeant"; }
else if(Account[targetid][pRank] == 7) { rtext = "Staff Sergeant"; }
else if(Account[targetid][pRank] == 8) { rtext = "Lieutenant"; }
else if(Account[targetid][pRank] == 9) { rtext = "Captain"; }
else if(Account[targetid][pRank] == 10) { rtext = "Commander"; }
else if(Account[targetid][pRank] == 11) { rtext = "Chief"; }
else { rtext = "Cadet"; }
}
and this
pawn Код:
if(Account[targetid][pMember] == 4 || Account[targetid][pLeader] == 4) { ttext = "Medic"; }
else if(gTeam[targetid] == 3 || gTeam[targetid] == 4) { ttext = "Civilian"; }
else if(Account[targetid][pMember] == 1 || Account[targetid][pLeader] == 1) { ttext = "Officer"; }
what the problem with "rtext" and "ttext" ? help me