SA-MP Forums Archive
GivePlayerMoney - 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: GivePlayerMoney (/showthread.php?tid=239082)



GivePlayerMoney - grand.Theft.Otto - 12.03.2011

Well, when someone spawns and connects for the very first time and if they are unregistered, how can I make it give them cash on spawn only ONCE, so when they die and respawn, they don't gain the money again.

On my server, if the player is registered, they only get the amount of money they had on their last session before they /q so I don't want to give them money on spawn.

Anyone?


Re: GivePlayerMoney - LZLo - 12.03.2011

PHP код:
new pname[MAX_PLAYER_NAME];
new 
Oncemoney[100];
new 
Moneyed[MAX_PLAYERS];
forward Once_OnPlayerConnect(playerid); 
PHP код:
public OnPlayerConnect(playerid)
{
   
Once_OnPlayerConnect(playerid);
if(
Moneyed[playerid] == 0) {
   
GivePlayerMoney(playerid20000);
   
dini_IntSet(Oncemoney"Moneyed"1);
}
return 
1;

PHP код:
public Oncemoney_OnPlayerConnect(playerid){
GetPlayerName(playeridpnamesizeof(pname));
format(Oncemoneysizeof(Oncemoney), "/Oncemoney/%s.ini",pname);
if(!
dini_Exists(Oncemoney))
{
dini_Create(Oncemoney);
dini_IntSet(Oncemoney"Moneyed"0);
Moneyed[playerid] = dini_Int(Oncemoney"Moneyed");
}
else
{
Moneyed[playerid] = dini_Int(Oncemoney"Moneyed");
}
return 
1;

+++Create an Oncemoney folder in the scriptfiles folder


Re: GivePlayerMoney - grand.Theft.Otto - 12.03.2011

Thanks but I got these errors:
pawn Код:
C:\Documents and Settings\User\Desktop\Las Venturas True Crime\gamemodes\lvtc.pwn(4869) : error 017: undefined symbol "dini_Exists"
C:\Documents and Settings\User\Desktop\Las Venturas True Crime\gamemodes\lvtc.pwn(4871) : error 017: undefined symbol "dini_Create"
C:\Documents and Settings\User\Desktop\Las Venturas True Crime\gamemodes\lvtc.pwn(4872) : error 017: undefined symbol "dini_IntSet"
C:\Documents and Settings\User\Desktop\Las Venturas True Crime\gamemodes\lvtc.pwn(4873) : error 017: undefined symbol "dini_Int"
C:\Documents and Settings\User\Desktop\Las Venturas True Crime\gamemodes\lvtc.pwn(4877) : error 017: undefined symbol "dini_Int"
Line:

pawn Код:
if(!dini_Exists(Oncemoney))
{
dini_Create(Oncemoney);
dini_IntSet(Oncemoney, "Moneyed", 0);
Moneyed[playerid] = dini_Int(Oncemoney, "Moneyed");
}
else
{
Moneyed[playerid] = dini_Int(Oncemoney, "Moneyed");
Do I need #include <Dini> ? I tried including it but I got this error:

pawn Код:
C:\Documents and Settings\User\Desktop\Las Venturas True Crime\gamemodes\lvtc.pwn(1620) : error 004: function "Once_OnPlayerConnect" is not implemented
Line:

pawn Код:
Once_OnPlayerConnect(playerid);



Re: GivePlayerMoney - Tommy_Mandaz - 12.03.2011

Make sure you have:

Код:
#include <dini>



Re: GivePlayerMoney - grand.Theft.Otto - 12.03.2011

Yeah. I did. It got this 1 error:

pawn Код:
C:\Documents and Settings\User\Desktop\Las Venturas True Crime\gamemodes\lvtc.pwn(1620) : error 004: function "Once_OnPlayerConnect" is not implemented
Line:

pawn Код:
Once_OnPlayerConnect(playerid);



Re: GivePlayerMoney - Tommy_Mandaz - 12.03.2011

I really dont know what that is suppose to mean... Wait for LZLo to help you with it sorry.

But you can try this:

Make a backup of the current Gamemode then try to remove the:

Код:
forward Once_OnPlayerConnect(playerid);
And then try to change this:

Код:
Once_OnPlayerConnect(playerid);
Into the normal:

Код:
OnPlayerConnect(playerid);