SA-MP Forums Archive
How to edit spawn cash / money? - 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: How to edit spawn cash / money? (/showthread.php?tid=402029)



How to edit spawn cash / money? - xDanger - 24.12.2012

Hello,
I'm wondering how to edit the players money when they register i choose example they start with 40000.

And im requesting a robbank system.


Re: How to edit spawn cash / money? - Lynet - 24.12.2012

public OnPlayerSpawn(playerid)
{
GivePlayerMoney(playerid,40000);
Return 1;
}


Re: How to edit spawn cash / money? - jNkk - 24.12.2012

He wants it when the first time the player registers.
That code will make him get 40k every spawn.


Re: How to edit spawn cash / money? - xDanger - 25.12.2012

Tried that, didnt work...


Re: How to edit spawn cash / money? - Faisal_khan - 25.12.2012

Add
pawn Код:
GivePlayerMoney(playerid,40000);
in the register system where you save the players password and stuffs.


Re : How to edit spawn cash / money? - Rayan_black - 25.12.2012

Go to your .pwn look for OnPlayerConnect, and add this:
GivePlayerMoney(playerid, 40000);


Re: Re : How to edit spawn cash / money? - B-Matt - 25.12.2012

Quote:
Originally Posted by Rayan_black
Посмотреть сообщение
Go to your .pwn look for OnPlayerConnect, and add this:
GivePlayerMoney(playerid, 40000);
And everytime when player connects he will get 40k o.O If is Kush's tutorial search for register dialog and put there GivePlayerMoney function.


Re: Re : How to edit spawn cash / money? - Don21x - 25.12.2012

Well im having problems with my registry but the fix to your problem would be like this

if (strcmp(cmd, "/register", true)==0)
{
new string[265];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, grey, "USAGE: /register [password]");
return 1;
}
if (gPlayerAccount[playerid] == 1)
{
SendClientMessage(playerid, grey, " That nickname is already registered");
return 1;
}

strmid(PlayerInfo[playerid][pPassword], tmp, 0, strlen(cmdtext), 255);
String(PlayerInfo[playerid][pPassword]);
GetPlayerName(playerid, playername, sizeof(playername));
format(string, sizeof(string), "%s.cer", playername);
new File: file = fopen(string, io_read);
if (file)
{
SendClientMessage(playerid, grey, " That name is already registered");
fclose(file);
return 1;
}
//new File:hFile; its now global
hFile = fopen(string, io_append);
new var[32];//
format(var, 32, "%s\n", PlayerInfo[playerid][pPassword]);fwrite(hFile, var);
format(var, 32, "Level:%d\n",PlayerInfo[playerid][pLevel]);fwrite(hFile, var);
format(var, 32, "Exp:%d\n",PlayerInfo[playerid][pExp]);fwrite(hFile, var);
format(var, 32, "Kills:%d\n",PlayerInfo[playerid][pKills]);fwrite(hFile, var);
format(var, 32, "Deaths:%d\n",PlayerInfo[playerid][pDeaths]);fwrite(hFile, var);
PlayerInfo[playerid][pCash] = GetPlayerMoney(playerid);
format(var, 32, "Cash:%d\n",PlayerInfo[playerid][pCash]);fwrite(hFile, var);
fclose(hFile);
SendClientMessage(playerid, white, "Succesfully Registered!");
gPlayerAccount[playerid] = 1;
SendClientMessage(playerid, white, "Next time when you come , use /login [ password ].");
GivePlayerMoney(playerid, 40000);// They get 40k as they register but only for this moment
OnPlayerLogin(playerid,PlayerInfo[playerid][pPassword]);
return 1;
}
return 0;


Re: How to edit spawn cash / money? - SKAzini - 25.12.2012

Don, please use [ pawn]PAWN CODE HERE[/pawn ] tags when you post a code.

But yes,

pawn Код:
GivePlayerMoney(playerid, 40000);
Is to be added under your registering part of your script eg.

pawn Код:
RegisterPlayer(playerid, password[])
{
    //register player code blabla
    GivePlayerMoney(playerid, 40000);
}



Re: How to edit spawn cash / money? - xDanger - 25.12.2012

Didn't work.....