public OnPlayerEnterRaceCheckpoint(playerid)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
PlayerPlaySound(playerid, 1139, x, y, z);
switch(Stats[playerid])
{
case 1:
{
new tmp[256];
static place;
place++;
DisablePlayerRaceCheckpoint(playerid);
PlayerPlaySound(playerid, 1056, 0.0, 0.0, 10.0);
SetPlayerRaceCheckpoint(playerid, 0,3016.3357,-1632.8782,67.4452,3067.0481,-1652.2799,80.6263,10);
Stats[playerid] = 2;
format (tmp, sizeof (tmp) , " %d" , place) ;
TextDrawSetString(Textdraw1,tmp);
return 1;
}
new ClosestID = INVALID_PLAYER_ID;
new Float:ClosestDis = 0;
for(new i; i < GetMaxPlayers(); i++)
{
if(ClosestID == INVALID_PLAYER_ID || GetPlayerDistanceToPoint(i, X, Y, Z) < ClosestDis)
{
ClosestID = i;
ClosestDis = GetPlayerDistanceToPoint(i, X, Y, Z);
}
}
stock GetPlayerDistanceToPoint(playerid, Float:X, Float:Y, Float:Z)
{
new Float:XP,Float:YP,Float:ZP;
GetPlayerPos(playerid,XP,YP,ZP);
return (XP - X) + (YP - Y) + (ZP - Z);
}
new EntroARace[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
EntroARace[playerid] = 0;
return 1;
}
public OnPlayerEnterRaceCheckpoint(playerid)
{
for(new i; i < GetMaxPlayers(); i++)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
PlayerPlaySound(playerid, 1139, x, y, z);
switch(Stats[playerid])
{
case 1:
{
EntroARace[playerid] = 1;
new tmp[256];
static place;
place++;
DisablePlayerRaceCheckpoint(playerid);
PlayerPlaySound(playerid, 1056, 0.0, 0.0, 10.0);
SetPlayerRaceCheckpoint(playerid, 0,3016.3357,-1632.8782,67.4452,3067.0481,-1652.2799,80.6263,10);
Stats[playerid] = 2;
format (tmp, sizeof (tmp) , " %d" , place) ;
TextDrawSetString(Textdraw1,tmp);
return 1;
}
case 2:
{
EntroARace[playerid] = 2;
//Cуdigos...
}
Stats[playerid] = 2;
Si te das cuenta
pawn Код:
|