How to edit spawn cash / money?
#1

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

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

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

Tried that, didnt work...
Reply
#5

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

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

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.
Reply
#8

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;
Reply
#9

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

Didn't work.....
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)