Score - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Score (
/showthread.php?tid=87236)
Score -
sggassasin - 19.07.2009
hi there could someone help me with the score so it dosent register kill it dose money a little help thx for ur time
Also could you help me with this
http://forum.sa-mp.com/index.php?topic=111987.0
Re: Score -
Mr_Finnigan - 19.07.2009
Quote:
Originally Posted by sggassasin
|
Код:
public OnPlayerDeath(playerid, killerid, reason)
{
SendDeathMessage(killerid, playerid, reason);
GivePlayerMoney(killerid, 5000);
return 1;
}
Re: Score -
sggassasin - 19.07.2009
i dont whant to give player money i whant it to when you check the score such as tab insted of showing up howmany kill you got it showes how much money you got
Re: Score -
Pawno_Master - 19.07.2009
new playermoney
playermoney = GetPlayerMoney(playerid)
OnPlayerConnect
SetPlayerScore(playerid, playermoney);
Re: Score -
Weirdosport - 19.07.2009
Quote:
Originally Posted by ekeleke
new playermoney
playermoney = GetPlayerMoney(playerid)
OnPlayerConnect
SetPlayerScore(playerid, playermoney);
|
This will work, but in a very limited way. During the course of the game the player is likely to gain/lose money, and this will not compensate for that. You need to use a timer that goes off at regular intervals.
pawn Код:
#include <a_samp>
forward MoneyCheck();
#define PERIOD 5000 //Time in ms between each score update. Low = laggy, High = bigger waits between updates
public OnGameModeInit()
{
SetTimer("MoneyCheck", PERIOD, 1);
return 1;
}
public MoneyCheck()
{
for(new i; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
SetPlayerScore(i,GetPlayerMoney(i));
}
}
}
Re: Score -
Pawno_Master - 19.07.2009
or
if he does somethin g
with /buydrugs
or anythiong in that way
for eample
if(strcmd,"/buydrugs", blablabla
SendClientMessage(playerid, 0xAA3333AA,"You have bought some drugs");
GivePlayerMoney(playerid, -1000);
SetPlayerScore(playerid, playermoney
Re: Score -
Weirdosport - 19.07.2009
@ekeleke: That's all well and good, but there are little things like stunt bonuses, and the amount you get taken off you when you die that you can't detect without a timer.
Re: Score -
Pawno_Master - 19.07.2009
You can put SetPlayerScore(playerid, playermoney);
under onplayerdeath
and he can disable stunt bonuses because i don't think he has a stunt server
but a timer is ok
but if he is a beginning scripter he will understand SetPlayerScore better
Re: Score -
Mr_Finnigan - 19.07.2009
Quote:
Originally Posted by sggassasin
|
The guy specificly asks how to give money instead of a point when there is a kill and when i show he him he said he did not want to know how to give money? Funny thats exactly what he asked for.