18.10.2011, 20:31
pawn Код:
new bool:HasBarrel[MAX_PLAYERS]; //On the top of your script
public OnPlayerPickUpPickup(playerid, pickupid)
{
if(pickupid == pickup1) SetPlayerCheckpoint(playerid, 1982.6150, -220.6680, -0.2432, 3.0);
new name[MAX_PLAYER_NAME], string[44];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "%s has found a barrel.",name);
SendClientMessageToAll(0xFFFF00AA, string);
HasBarrel[playerid] = true;
return 1;
}
public OnPlayerDeath(playerid,killerid,reason)
{
if(HasBarrel[playerid] == true)
{
HasBarrel[playerid] = false;
SendClientMessage(playerid,0xFF0000FF,"You lost the barrel!");
}
return 1;
}
if(HasBarrel[playerid] == true) HasBarrel[playerid] = false; //Under OnPlayerDisconnect
public OnPlayerEnterCheckpoint(playerid)
{
if(HasBarrel[playerid] == true)
{
GivePlayerMoney(playerid, 10000);
DisablePlayerCheckpoint(playerid);
new name[MAX_PLAYER_NAME], string[44];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "%s has delivered a barrel.",name);
SendClientMessageToAll(0xFFFF00AA, string);
HasBarrel[playerid] = false;
return 1;
}
else SendClientMessage(playerid,0xFFFF00AA,"You don't have a barrel!");
return 1;
}