[HELP] Is this possible? - 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: [HELP] Is this possible? (
/showthread.php?tid=211584)
[HELP] Is this possible? - Larsey123IsMe - 15.01.2011
Like "GetPlayerHealth" and "SetPlayerHealth"
Here is an example of what i mean:
pawn Код:
#include <a_samp>
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/givemefish", cmdtext, true, 10) == 0)
{
SetPlayerFish(playerid, +1);
SendClientMessage(playerid, 0xFF0000FF, "You gave yuorself 1 fish");
return 1;
}
if (strcmp("/howmanyfish", cmdtext, true, 10) == 0)
{
new MyFish;
MyFish = GetPlayerFish(playerid);
format(string, sizeof(string), "You have %s fish", fish);
SendClientMessage(playerid, 0xFF0000FF, string);
return 1;
}
return 0;
}
stock GetPlayerFish(playerid, fish)
{
//Code
return 1;
}
stock SetPlayerFish(playerid, fish)
{
//Code
return 1;
}
Re: [HELP] Is this possible? -
jamesbond007 - 15.01.2011
possible... if u want i can show u later..
Re: [HELP] Is this possible? -
Kase - 15.01.2011
pawn Код:
#include <a_samp>
new pFish[MAX_PLAYERS];
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/givemefish", cmdtext, true, 10) == 0)
{
SetPlayerFish(playerid, GetPlayerFish(playerid)+1);
SendClientMessage(playerid, 0xFF0000FF, "You gave yuorself 1 fish");
return 1;
}
if (strcmp("/howmanyfish", cmdtext, true, 10) == 0)
{
new MyFish, string[256];
MyFish = GetPlayerFish(playerid);
format(string, sizeof(string), "You have %d fish", MyFish);
SendClientMessage(playerid, 0xFF0000FF, string);
return 1;
}
return 0;
}
stock GetPlayerFish(playerid)
{
return pFish[playerid];
}
stock SetPlayerFish(playerid, fish)
{
pFish[playerid] = fish;
}
I made it in a hurry, let me know if you get any error
Re: [HELP] Is this possible? -
coole210 - 15.01.2011
^ kinda buggy, fixed vers:
Код:
#include <a_samp>
new pFish[MAX_PLAYERS];
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/givemefish", cmdtext, true, 10) == 0)
{
GivePlayerFish(playerid, 1);
SendClientMessage(playerid, 0xFF0000FF, "You gave yourself 1 fish");
return 1;
}
if (strcmp("/myfish", cmdtext, true, 10) == 0)
{
string[126];
format(string, sizeof(string), "You have %d fish", GetPlayerFish(playerid));
SendClientMessage(playerid, 0xFF0000FF, string);
return 1;
}
return 0;
}
stock GetPlayerFish(playerid)
{
return pFish[playerid];
}
stock SetPlayerFish(playerid, fish)
{
pFish[playerid] = fish;
return pFish[playerid];
}
stock GivePlayerFish(playerid,fish)
{
pFish[playerid] = pFish[playerid] + 1;
return pFish[playerid];
}
Re: [HELP] Is this possible? - Larsey123IsMe - 15.01.2011
Thanks