Interior name - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Interior name (
/showthread.php?tid=266776)
Interior name - Unknown123 - 06.07.2011
pawn Код:
new ZoneName[MAX_PLAYERS][128];
enum IntZoneInfo
{
IntName[27],
Float:IntMinX,
Float:IntMinY,
Float:IntMaxX,
Float:IntMaxY
}
new Float:IntZone[][IntZoneInfo] =
{
{ "Cluckin Bell", 362.6255, -12.18620, 381.4123, -6.106100},
{ "Ammunation", 283.9484, -112.9781, 298.6097, -102.7812}
};
stock GetPlayerInteriorName(playerid)
{
new Float:posX, Float:posY, Float:posZ;
GetPlayerPos(playerid, posX, posY, posZ);
if(posZ > 500.0)
{
for(new i=0; i < sizeof(IntZone); i++)
{
if(IsPlayerInArea(playerid, IntZone[playerid][IntMinX], IntZone[playerid][IntMinY], IntZone[playerid][IntMaxX], IntZone[playerid][IntMaxY]))
{
format(ZoneName[playerid], 128, IntZone[playerid][IntName]);
}
}
}
else
{
ZoneName[playerid] = "Unknown";
}
return ZoneName[playerid];
}
stock IsPlayerInArea(playerid, Float:minX, Float:minY, Float:maxX, Float:maxY)
{
new Float:posX, Float:posY, Float:posZ;
GetPlayerPos(playerid, posX, posY, posZ);
if(posX >= minX && posX <= maxX && posY >= minY && posY <= maxY) return 1;
return 0;
}
This returns to wrong name
Re: Interior name -
Backwardsman97 - 06.07.2011
You can't use strings inside of enumerations.
Re: Interior name -
=WoR=Varth - 06.07.2011
Quote:
Originally Posted by Backwardsman97
You can't use strings inside of enumerations.
|
No you can.
@Unknown123 what do you mean by wrong name?
Re: Interior name - Unknown123 - 06.07.2011
Like if im in the Ammunation, then it sais Cluckin Bell, and somethimes it output blank
i use this to test
pawn Код:
CMD:int(playerid,params[])
{
new string[128];
format(string,sizeof(string),"Interior name: %s", GetPlayerInteriorName(playerid));
SendClientMessage(playerid,-1,string);
return 1;
}
Re: Interior name -
Backwardsman97 - 06.07.2011
Quote:
Originally Posted by varthshenon
No you can.
@Unknown123 what do you mean by wrong name?
|
Not if you're using it like that.
Re: Interior name - Unknown123 - 06.07.2011
Quote:
Originally Posted by Backwardsman97
Not if you're using it like that.
|
Then how shoud i use it?
Re: Interior name -
Backwardsman97 - 06.07.2011
Create a seperate array to deal with the names.
Re: Interior name -
=WoR=Varth - 06.07.2011
pawn Код:
OnPlayerChangeInterior(playerid)
{
if(IsPlayerInRangeOfPoint(playerid,20,XCenter,YCenter,ZCenter) return format(ZoneName[playerid],128,"Cluckin Bell");
Much better?
Re: Interior name -
Laronic - 06.07.2011
pawn Код:
stock GetPlayerInteriorName(playerid)
{
new Float:posX, Float:posY, Float:posZ;
GetPlayerPos(playerid, posX, posY, posZ);
if(posZ > 500.0)
{
for(new i = 0; i < sizeof(IntZone); i++)
{
if(IsPlayerInArea(playerid, IntZone[i][IntMinX], IntZone[i][IntMinY], IntZone[i][IntMaxX], IntZone[i][IntMaxY]))
{
format(ZoneName[playerid], 128, IntZone[i][IntName]);
}
}
}
else
{
ZoneName[playerid] = "Unknown";
}
return ZoneName[playerid];
}
Re: Interior name - Unknown123 - 06.07.2011
Ty man!