public OnPlayerPickUpPickup(playerid,pickupid) //If you have one of these add the stuff in this to your one =]
{
for(new C; C<BusinessCount; C++)
{
if(pickupid == BusinessPickup[C]) //Checks if the pickup is for a business
{
new str[150];
if(BusinessInfo[C][BusOwner] == -1) format(str, sizeof(str), "%s ~n~~r~Cost price: $%d ~b~Sale price: $%d ~n~ ~g~Earn ammount: $%d", BusinessInfo[C][BusName], BusinessInfo[C][BusCost], BusinessInfo[C][BusSell], BusinessInfo[C][BusEarn]); //Makes the string for a business with no owner.
if(BusinessInfo[C][BusOwner] != -1)
{
new Pname[24]; //Creates player name variable
GetPlayerName(BusinessInfo[C][BusOwner], Pname, 24); //Gets player name
format(str, sizeof(str), "%s ~n~~r~Cost price: $%d ~b~Sale price: $%d ~n~ ~g~Earn ammount: $%d~n~~w~Owner: %s(%d)", BusinessInfo[C][BusName], BusinessInfo[C][BusCost], BusinessInfo[C][BusSell], BusinessInfo[C][BusEarn], Pname, BusinessInfo[C][BusOwner]);
SendClientMessage(playerid,0x00FF00AA,str);
}
}
}
return 1;
}
public OnPlayerPickUpPickup(playerid,pickupid) //If you have one of these add the stuff in this to your one =]
{
for(new C; C<BusinessCount; C++)
{
if(pickupid == BusinessPickup[C]) //Checks if the pickup is for a business
{
new str[150];
if(BusinessInfo[C][BusOwner] == -1)
{
format(str, sizeof(str), "%s ~n~~r~Cost price: $%d ~b~Sale price: $%d ~n~ ~g~Earn ammount: $%d", BusinessInfo[C][BusName], BusinessInfo[C][BusCost], BusinessInfo[C][BusSell], BusinessInfo[C][BusEarn]); //Makes the string for a business with no owner.
SendClientMessage(playerid,0x00FF00AA,str);
return 1;
}
else
{
new Pname[24]; //Creates player name variable
GetPlayerName(BusinessInfo[C][BusOwner], Pname, 24); //Gets player name
format(str, sizeof(str), "%s ~n~~r~Cost price: $%d ~b~Sale price: $%d ~n~ ~g~Earn ammount: $%d~n~~w~Owner: %s(%d)", BusinessInfo[C][BusName], BusinessInfo[C][BusCost], BusinessInfo[C][BusSell], BusinessInfo[C][BusEarn], Pname, BusinessInfo[C][BusOwner]);
SendClientMessage(playerid,0x00FF00AA,str);
return 1;
}
}
}
return 1;
}
BusinessPickup[BusinessCount] = AddStaticPickup(1272, 1, XPos, YPos, ZPos, -1);
forward CustomPickups(); ... SetTimer("CustomPickups",2000,true); ... public CustomPickups() { for(new i = 0;i < MAX_PLAYERS;i++) { if(PlayerToPoint(2.0,i,0.0,0.0,0.0)) //insert pickup co-ordinates here { GameTextForPlayer(i,"bla bla",2000,3); } else if(PlayerToPoint(2.0,i,0.0,0.0,0.0)) { GameTextForPlayer(i,"bla bla",2000,3); } } return 1; } ... stock PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z) { if(IsPlayerConnected(playerid)) { new Float:oldposx, Float:oldposy, Float:oldposz; new Float:tempposx, Float:tempposy, Float:tempposz; if(SpectateVehicle[playerid]) GetPlayerPos(playerid,oldposx,oldposy,oldposz); tempposx = (oldposx -x); tempposy = (oldposy -y); tempposz = (oldposz -z); if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi))) { return 1; } } return 0; }
for things like this I just use a proximity check in a function called by a repeating 2 second timer. It saves having to re-create the pickup.
|