Simple Pickup [Help] - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Simple Pickup [Help] (
/showthread.php?tid=375305)
Simple Pickup [Help] -
kbalor - 06.09.2012
Good day guys. I need help. Is it possible to GivePlayerMoney and show GameTextForPlayer ONLY for players who picks the Pickup except the Victim or his own Tombstone.
I mean is, If I killed myself or killed by someone. If I picked my own Tombstone then show nothing and don't give money. So people would not abuse killing themselves just to make money.
pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(pickupid == tombstonePickups[i])
{
new tombstring[MAX_PLAYER_NAME+20];
GetPlayerName(i,tombstring,MAX_PLAYER_NAME);
strins(tombstring, "~g~+$400 ~n~~r~Coffin of:~n~~w~", 0);
GameTextForPlayer(playerid,tombstring,3000,3);
DestroyPickup(tombstonePickups[playerid]);
tombstonePickups[playerid] = -1;
GivePlayerMoney(playerid, 400);
break;
}
}
return 1;
}
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
if(tombstonePickups[playerid] != -1)
{
DestroyPickup(tombstonePickups[playerid]);
}
new Float:pX, Float:pY, Float:pZ;
GetPlayerPos(playerid, pX, pY, pZ);
#if defined USE_OBJECT
new Float:pA;
GetPlayerFacingAngle(playerid, pA);
tombstonePickups[playerid] = CreatePickup(2896,23,pX,pY,pZ+0.3,GetPlayerVirtualWorld(playerid));
#else
tombstonePickups[playerid] = CreatePickup(2896,23,pX,pY,pZ,GetPlayerVirtualWorld(playerid));
#endif
return 1;
}
}
Re : Simple Pickup [Help] -
lelemaster - 06.09.2012
Do you mean like this?
pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(pickupid == tombstonePickups[i] && i != playerid)
{
new tombstring[MAX_PLAYER_NAME+20];
GetPlayerName(i,tombstring,MAX_PLAYER_NAME);
strins(tombstring, "~g~+$400 ~n~~r~Coffin of:~n~~w~", 0);
GameTextForPlayer(playerid,tombstring,3000,3);
DestroyPickup(tombstonePickups[playerid]);
tombstonePickups[playerid] = -1;
GivePlayerMoney(playerid, 400);
break;
}
}
return 1;
}
Re: Re : Simple Pickup [Help] -
kbalor - 06.09.2012
Quote:
Originally Posted by lelemaster
Do you mean like this?
pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid) { for(new i = 0; i < MAX_PLAYERS; i++) { if(pickupid == tombstonePickups[i] && i != playerid) { new tombstring[MAX_PLAYER_NAME+20]; GetPlayerName(i,tombstring,MAX_PLAYER_NAME); strins(tombstring, "~g~+$400 ~n~~r~Coffin of:~n~~w~", 0); GameTextForPlayer(playerid,tombstring,3000,3); DestroyPickup(tombstonePickups[playerid]); tombstonePickups[playerid] = -1; GivePlayerMoney(playerid, 400); break; } } return 1; }
|
Wow Thanks man! But I haven't tested it yet with other players. For now I can't pick my own tombstone. Great! Anyway do you know how to add 3dTextLabel under the Tombstone? Really appreciate your help!
Re: Simple Pickup [Help] -
XtremeR - 06.09.2012
pawn Код:
Create3DTextLabel("I'm at the coordinates:\n30.0, 40.0, 50.0", 0x008080FF, 30.0, 40.0, 50.0, 40.0, 0, 0);
(text[], color, Float:X, Float:Y, Float:Z, Float:DrawDistance, virtualworld, testLOS)
https://sampwiki.blast.hk/wiki/Create3DTextLabel
+rep if that helps