IsPlayerInRangeOfPoint + /government System. -
Smxe - 22.10.2012
Hi guys lets get this off the bat - This is a zGaming edit!
Here is PROBLEM #1.
When doing /locker it dosent work. I have checked over 10000 times. Fixing the cordinates , Checking the proper interior.. Dosent work! Ive even tried adding a !IsPlayerInRangeOfPoint or just IsPlayerInRangeOfPoint.
Heres the command - Pawno returns no errors , It just says " Your are not in range of your locker "
Код:
CMD:locker(playerid, params[])
{
new string[128];
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(!IsACop(playerid))
{
if(IsPlayerInRangeOfPoint(playerid,6,255.39,77.26,1003.64)) return SendClientMessage(playerid, COLOR_GREY, "You aren't near your locker.");
ShowDialog(playerid, 5);
}
else if(IsAGov(playerid))
{
if(PlayerInfo[playerid][pFacRank] != 0) return SendClientMessage(playerid, COLOR_GREY, "Only bodyguards can access the lockers. (Rank 0)");
if(!IsPlayerInRangeOfPoint(playerid, 2,354.3801,173.7786,1008.3828)) return SendClientMessage(playerid, COLOR_GREY, "You aren't near your locker.");
GiveZaiatWeapon(playerid, 29, 500);
GiveZaiatWeapon(playerid, 24, 200);
format(string, sizeof(string), "* %s grabs a Desert Eagle and an MP5 from the lockers.", RPN(playerid), params);
SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
}
else if(IsAReporter(playerid))
{
if(!IsPlayerInRangeOfPoint(playerid, 2, 1203.1322,-751.8103,1073.1819)) return SendClientMessage(playerid, COLOR_GREY, "You aren't near your locker.");
ShowDialog(playerid, 27);
}
else SendClientMessage(playerid, COLOR_GREY, "You are not near a locker you can open.");
return 1;
}
Now for issue #2
Id like to bind /gov so all factions can use it, BUT I want all factions to have a specific colour. Like SAGU (SAn Andreas Gang Unit) To be DarkRED , For FBI to be LightBlue.
But Instead I made different CMDS.
Код:
}
CMD:fgov(playerid, params[])
{
new string[128];
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(!IsAFBI(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not a FBI Agent.");
if(!PlayerInfo[playerid][pFacLeader]) return SendClientMessage(playerid, COLOR_GREY, "You are not a faction leader.");
if(sscanf(params, "s[128]", params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: (/fgov)ernment announcement [text]");
if(AntiAdv(playerid, params)) return 1;
SendClientMessageToAll(COLOR_BLUE, "|___________Federal Bureau Of Investigation Announcement ___________|");
format(string, sizeof(string), "** %s %s %s: %s **", RPFN(playerid), RPFRN(playerid), RPN(playerid), params);
SendClientMessageToAll(COLOR_BLUE, string);
return 1;
}
CMD:sgov(playerid, params[])
{
new string[128];
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(!IsASagu(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not in the SAGU.");
if(!PlayerInfo[playerid][pFacLeader]) return SendClientMessage(playerid, COLOR_GREY, "You are not a faction leader.");
if(sscanf(params, "s[128]", params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: (/sgov)ernment announcement [text]");
if(AntiAdv(playerid, params)) return 1;
SendClientMessageToAll(COLOR_DARKRED, "|___________San Andreas Gang Unit Announcement ___________|");
format(string, sizeof(string), "** %s %s %s: %s **", RPFN(playerid), RPFRN(playerid), RPN(playerid), params);
SendClientMessageToAll(COLOR_DARKRED, string);
return 1;
}
CMD:gov(playerid, params[])
{
new string[128];
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(!IsACop(playerid) && !IsAGov(playerid) && !IsASagu(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not an SAPD Oficer/Government Official.");
if(!PlayerInfo[playerid][pFacLeader]) return SendClientMessage(playerid, COLOR_GREY, "You are not a faction leader.");
if(sscanf(params, "s[128]", params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: (/gov)ernment announcement [text]");
if(AntiAdv(playerid, params)) return 1;
SendClientMessageToAll(COLOR_GREEN, "|___________San Andreas Government News Announcement ___________|");
format(string, sizeof(string), "** %s %s %s: %s **", RPFN(playerid), RPFRN(playerid), RPN(playerid), params);
SendClientMessageToAll(COLOR_GREEN, string);
return 1;
}
If you can help please say so, Thank you so much. <3 - Again thanks ahead of time =D.
((NOTE: RPFN - RP Faction name , RPFRN - RP Faction Rank Name - RPN - RP NAME ))
Re: IsPlayerInRangeOfPoint + /government System. -
denNorske - 22.10.2012
#Issue 1:
What you did in your first code, you made your server return:
PHP код:
if(IsPlayerInRangeOfPoint(playerid,6,255.39,77.26,1003.64)) return SendClientMessage(playerid, COLOR_GREY, "You aren't near your locker.");
So, if the player was in range of that point: then return he wasn't close enough to it. So, i am doing it the simple way, so instead of that, use:
PHP код:
if(!IsPlayerInRangeOfPoint(playerid,6,255.39,77.26,1003.64))
{
SendClientMessage(playerid,COLOR_GREY,"You aren't near your locker.");
}
//rest here
And then, it will look like this i guess:
PHP код:
CMD:locker(playerid, params[])
{
new string[128];
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "[DEBUG] Not logged in. [MESSAGE]You need to login first before using any command.");
if(!IsACop(playerid))
{
if(!IsPlayerInRangeOfPoint(playerid,6,255.39,77.26,1003.64))
{
SendClientMessage(playerid, COLOR_GREY, "[DEBUG]You are a cop. [MESSAGE]You aren't near your locker.");
}
ShowDialog(playerid, 5);
}
else if(IsAGov(playerid))
{
if(PlayerInfo[playerid][pFacRank] != 0) return SendClientMessage(playerid, COLOR_GREY, "Only bodyguards can access the lockers. (Rank 0)");
if(!IsPlayerInRangeOfPoint(playerid, 2,354.3801,173.7786,1008.3828)) return SendClientMessage(playerid, COLOR_GREY, "[DEBUG] you are a Gov. [MESSAGE]You aren't near your locker.");
GiveZaiatWeapon(playerid, 29, 500);
GiveZaiatWeapon(playerid, 24, 200);
format(string, sizeof(string), "* %s grabs a Desert Eagle and an MP5 from the lockers.", RPN(playerid), params);
SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
}
else if(IsAReporter(playerid))
{
if(!IsPlayerInRangeOfPoint(playerid, 2, 1203.1322,-751.8103,1073.1819))
{
SendClientMessage(playerid, COLOR_GREY, "[DEBUG] You are a reporter. [MESSAGE] You are not in range of any locker");
}
ShowDialog(playerid, 27);
}
else SendClientMessage(playerid, COLOR_GREY, "[DEBUG] No defined class. [MESSAGE]You are not near a locker you can open."); //This message tells the player he cant open any of the lockers he is close to.
return 1;
}
If any of my help was helpful, yeah, i would appreciate the +rep
But, are you sure you are the right class? (Cop, Gov, anything else?) I added Debug messages to your code. So when you try next time, tell me which message it shows you, okay?
Then i can fix it for you, if it still doesn't work for you.
#Issue 2:
Okay, i tried to do what you wanted in this code. But if anything is wrong, or if you get any errors, please let ME know, so i can fix it!
Here it is:
PHP код:
CMD:gov(playerid, params[])
{
new string[128];
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(!IsACop(playerid) && !IsAGov(playerid) && !IsASagu(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not an SAPD Oficer/Government Official.");
if(!PlayerInfo[playerid][pFacLeader]) return SendClientMessage(playerid, COLOR_GREY, "You are not a faction leader.");
if(sscanf(params, "s[128]", params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: (/gov)ernment announcement [text]");
if(AntiAdv(playerid, params)) return 1;
if(IsACop(playerid))
{
SendClientMessageToAll(COLOR_GREEN, "|___________San Andreas Government News Announcement ___________|");
format(string, sizeof(string), "** %s %s %s: %s **", RPFN(playerid), RPFRN(playerid), RPN(playerid), params);
SendClientMessageToAll(COLOR_GREEN, string);
}
else if(IsASagu(playerid))
{
SendClientMessageToAll(COLOR_DARKRED, "|___________San Andreas Government News Announcement ___________|");
format(string, sizeof(string), "** %s %s %s: %s **", RPFN(playerid), RPFRN(playerid), RPN(playerid), params);
SendClientMessageToAll(COLOR_DARKRED, string);
}
else if(IsAGov(playerid))
{
SendClientMessageToAll(COLOR_GREEN, "|___________San Andreas Government News Announcement ___________|");
format(string, sizeof(string), "** %s %s %s: %s **", RPFN(playerid), RPFRN(playerid), RPN(playerid), params);
SendClientMessageToAll(COLOR_GREEN, string);
}
else if(IsAFBI(playerid))
{
SendClientMessageToAll(COLOR_BLUE, "|___________San Andreas Government News Announcement ___________|");
format(string, sizeof(string), "** %s %s %s: %s **", RPFN(playerid), RPFRN(playerid), RPN(playerid), params);
SendClientMessageToAll(COLOR_BLUE, string);
}
return 1;
}
Re: IsPlayerInRangeOfPoint + /government System. -
Smxe - 23.10.2012
Thank you so much! Ill try them! , It means alot You have recived your rep and again THANKS