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



KCASH problem. - Sal_Kings - 02.09.2009

My server uses this cheap type of money called "KCASH" ...
They are like points but they are money at the same time...
This goes at the top of my script.
Код:
new KCASH[MAX_PLAYERS];
And when you spawn .. I want it to give you 15 KCASH .. So i put this under Publicongamemodeinit

Код:
KCASH[playerid]++;
KCASH[playerid]++;
KCASH[playerid]++;
KCASH[playerid]++;
KCASH[playerid]++;
KCASH[playerid]++;
KCASH[playerid]++;
KCASH[playerid]++;
KCASH[playerid]++;
KCASH[playerid]++;
KCASH[playerid]++;
KCASH[playerid]++;
KCASH[playerid]++;
KCASH[playerid]++;
KCASH[playerid]++;
Errors i get.
Код:
C:\Documents and Settings\home\Desktop\samp02Xserver.win32\gamemodes\KingsRPG.pwn(71) : error 017: undefined symbol "playerid"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.



Re: KCASH problem. - Battlaman - 02.09.2009

Код:
OnPlayerSpawn(playerid)
{
KCASH[playerid]++;
KCASH[playerid]++;
KCASH[playerid]++;
KCASH[playerid]++;
KCASH[playerid]++;
KCASH[playerid]++;
KCASH[playerid]++;
KCASH[playerid]++;
KCASH[playerid]++;
KCASH[playerid]++;
KCASH[playerid]++;
KCASH[playerid]++;
KCASH[playerid]++;
KCASH[playerid]++;
KCASH[playerid]++;
return 1;
}
But you can use this too

Код:
OnPlayerSpawn(playerid)
{
   GivePlayerMoney(playerid, 15);
   return 1;
}



Re: KCASH problem. - Alice[WS] - 02.09.2009

Add this before main() :

Код:
new KCash[MAX_PLAYERS];

stock GivePlayerKCash(playerid, money)
{
KCash[playerid] = KCash[playerid] + money;
return KCash[playerid];
}
Then:
Код:
OnPlayerSpawn(playerid)
{
GivePlayerKCash(playerid, 15);
return 1;
}
Have fun !


Re: KCASH problem. - Sal_Kings - 02.09.2009

Ty battleman .. But uhhh Alice .. I can't understand that .. Because i don't know how to make that work with my /Kcash cmd that shows how much KCASH you have.


Re: KCASH problem. - Alice[WS] - 02.09.2009

How do you scripted your /Kcash command ? Isn't it something like this ?

Код:
  if (strcmp("/kcash", cmdtext, true) == 0)
    {
        new string[256];
        format(string, sizeof(string), "KCASH : %d", GetPlayerKCash(playerid));
        SendClientMessage(playerid, COLOR, string);
        return 1;
    }



Re: KCASH problem. - Sal_Kings - 02.09.2009

No it's

Код:
 if(!strcmp(cmdtext,"/kcash",true))
{
  format(string, sizeof string, "You have %i KCASH in your bag.", KCASH[playerid]);
  SendClientMessage(playerid,COLOR_GREEN,string);
  return 1;
}



Re: KCASH problem. - Alice[WS] - 02.09.2009

in fact it's the same, just add what i said and it will works with your command.


Re: KCASH problem. - Clavius - 02.09.2009

Quote:
Originally Posted by Sal_Kings
And when you spawn .. I want it to give you 15 KCASH .. So i put this under Publicongamemodeinit

Код:
KCASH[playerid]++;
KCASH[playerid]++;
KCASH[playerid]++;
KCASH[playerid]++;
KCASH[playerid]++;
KCASH[playerid]++;
KCASH[playerid]++;
KCASH[playerid]++;
KCASH[playerid]++;
KCASH[playerid]++;
KCASH[playerid]++;
KCASH[playerid]++;
KCASH[playerid]++;
KCASH[playerid]++;
KCASH[playerid]++;
and instead these unneeded lines, you can use:
KCASH[playerid] += 15;


Re: KCASH problem. - Sal_Kings - 02.09.2009

Quote:
Originally Posted by player007
Quote:
Originally Posted by Sal_Kings
And when you spawn .. I want it to give you 15 KCASH .. So i put this under Publicongamemodeinit

Код:
KCASH[playerid]++;
KCASH[playerid]++;
KCASH[playerid]++;
KCASH[playerid]++;
KCASH[playerid]++;
KCASH[playerid]++;
KCASH[playerid]++;
KCASH[playerid]++;
KCASH[playerid]++;
KCASH[playerid]++;
KCASH[playerid]++;
KCASH[playerid]++;
KCASH[playerid]++;
KCASH[playerid]++;
KCASH[playerid]++;
and instead these unneeded lines, you can use:
KCASH[playerid] += 15;
Ty player! I will use that .. Best one so far