Author Topic: How to add loc on player death.....  (Read 2450 times)

0 Members and 1 Guest are viewing this topic.

Offline [Tkiller]

  • Street Thug
  • *
  • Posts: 15
    • View Profile
How to add loc on player death.....
« on: March 13, 2012, 04:54:22 pm »
iam trying to add loc but iam failed so i post it....
please help me

[pawn]      MessagePMFormat(killerid, GREEN,"Killed: %s, Wep: %s, Part: %s, Distance: %d, Reward:$ %d, Loc: %s",gPlayers[playerid],GetWeaponNameID(reason),GetBodyPartName(bodypart),GetDistance(playerid,killerid),reward,GetPlayerLocation( playerid ));[/pawn]

on playerlocation i put that but something happened wrong it gives me Bodypart loc why....
[pawn]public GetPlayerLocation( playerid )
{
   new a=0, b=1, c=0;
      new szMsg[ 256 ];
      format( szMsg, sizeof( szMsg ), "Vice-City" );
   new Float:x, Float:y, Float:z;
   GetPlayerPos(playerid, x, y, z);
   return 1;
}[/pawn]

Offline stormeus

  • VC:MP Developer
  • VC:MP Veteran
  • *
  • Posts: 1122
    • View Profile
Re: How to add loc on player death.....
« Reply #1 on: March 13, 2012, 10:27:32 pm »
[pawn]
public GetPlayerLocation( playerid )
{
   return "Vice-City";
}
[/pawn]
Do not PM me for support.




Offline VerceTTi

  • Street Thug
  • *
  • Posts: 6
  • Huh, WTF you see here the post is there >>
    • View Profile
Re: How to add loc on player death.....
« Reply #2 on: March 21, 2012, 01:30:55 pm »
well, you can also do this

[pawn]public GetPlayerLocation(playerid)
{
   new a=0,b=1,c=0;
      new szMsg[256];
      format(szMsg,sizeof(szMsg),"Vice-City");
   while (c!=120)
    {
      if (IsPlayerInArea(playerid,area[a],area))
      {
         szMsg=areas(c);
            break;
      }
      a=(a+2);
      b=(b+2);
      c++;
   }
   return szMsg;
}[/pawn]

Public Player in Area

[pawn]stock IsPlayerInArea(playerid,Float:XCoords[],Float:YCoords[])
{
   new a=0,b=0;
   while(a!=15)
   {
       if (YCoords[a] != 0.000000 && XCoords[a] != 0.000000)
      {
           b++;
        }
        a++;
   }
   new u = b-1, Intersect = 0, Float:X, Float:Y, Float:Z; GetPlayerPos(playerid,X,Y,Z);
   for(new v = 0; v < b; v++)
   {
      if((YCoords[v] < Y && YCoords >= Y) || (YCoords < Y && YCoords[v] >= Y))
      {
         if(XCoords[v] + (Y-YCoords[v]) / (YCoords - YCoords[v]) * (XCoords - XCoords[v]) < X)
         {
            Intersect++;
         }
      }
      u = v;
   }
   return Intersect&1;
}[/pawn]

But i think what stormeus said was more easy and better than this.
TZ co-leader, XC Owner/Developer, Playing VC:MP Since 2010
KDM v2.4 Script will be releasing soon in 2013 April
Want to be admin in XC feel free to apply at www.xc-server.tk