pawn Код:
#define MAX_HORSE_SHOES 10
new pHorseShoeID [MAX_PLAYERS][MAX_HORSE_SHOES],
bool:pHorseShoeTaken [MAX_PLAYERS][MAX_HORSE_SHOES];
new const Float:HorseShoeCoords[MAX_HORSE_SHOES][3] =
{
{x, y, z},
{x, y, z},
{x, y, z},
{x, y, z},
{x, y, z},
{x, y, z},
{x, y, z},
{x, y, z},
{x, y, z},
{x, y, z}
}; // Replace x, y, z with coordinates
stock GetPlayerHorseshoes(playerid)
{
new shoes;
for(new i; i < MAX_HORSE_SHOES; i ++)
{
if(pHorseShoeTaken[playerid][i])
shoes ++;
}
return shoes;
}
public OnPlayerConnect(playerid)
{
for(new i; i < MAX_HORSE_SHOES; i ++)
{
new Float:x, Float:y, Float:z;
x = HorseShoeCoords[i][0];
y = HorseShoeCoords[i][1];
z = HorseShoeCoords[i][2];
pHorseShoeID[playerid][i] = CreateDynamicPickup(954, 1, x, y, z, -1, -1, playerid);
pHorseShoeTaken[playerid][i] = false;
}
}
public OnPlayerDisconnect(playerid, reason)
{
for(new i; i < MAX_HORSE_SHOES; i ++)
{
if(!pHorseShoeTaken[playerid][i])
{
DestroyDynamicPickup(pHorseShoeID[playerid][i]);
pHorseShoeTaken[playerid][i] = false;
}
}
}
public OnPlayerPickupDynamicPickup(playerid, pickupid)
{
for(new i; i < MAX_HORSE_SHOES; i ++)
{
if(pickupid == pHorseShoeID[playerid][i])
{
DestroyDynamicPickup(pHorseShoeID[playerid][i]);
pHorseShoeTaken[playerid][i] = true;
new string[47];
format(string, sizeof(string), "~g~You have picked up %i out of %i horseshoes!", GetPlayerHorseshoes(playerid), MAX_HORSE_SHOES);
GameTextForPlayer(playerid, string, 2000, 6);
PlayerPlaySound(playerid, 1150, 0.0, 0.0, 0.0);
}
}
}