Vice City Multiplayer

VC:MP 0.3 => mIRC/pawn Scripting => Topic started by: [Tkiller] on March 13, 2012, 04:54:22 pm

Title: How to add loc on player death.....
Post by: [Tkiller] 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]
Title: Re: How to add loc on player death.....
Post by: stormeus on March 13, 2012, 10:27:32 pm
[pawn]
public GetPlayerLocation( playerid )
{
   return "Vice-City";
}
[/pawn]
Title: Re: How to add loc on player death.....
Post by: VerceTTi 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.