GivePlayerMoney
#1

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?
Reply
#2

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
Reply
#3

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);
Reply
#4

Make sure you have:

Код:
#include <dini>
Reply
#5

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);
Reply
#6

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);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)