SA-MP Forums Archive
enum [help] - 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: enum [help] (/showthread.php?tid=279429)



enum [help] - doreto - 27.08.2011

i was wonder how to make player to buy beer and to save to my enum pInfo-pBeer i make /beer cmd but i dont know to make make /buybeer i try few ways but dont set pBeer=1 and i was wonther how i can stack many beers at one like 6 beers at ones not only one so here my /beeer cmd

PHP код:
CMD:beer(playeridparams[])
{
    if(
PlayerInfo[playerid][pBeer] >= 1)
    {
         
SetPlayerSpecialAction(playerid,SPECIAL_ACTION_DRINK_BEER);
    }
    else
    {
        
SendClientMessage(playerid,-1,"You don't have beer");
    }
    return 
true;




Re: enum [help] - [MG]Dimi - 27.08.2011

PHP код:
PlayerInfo[playerid][pBeer] = 0;  //if player doesn't have any beer. Put this OnPlayerConnect callback
//////
//once he buys beer 
PlayerInfo[playerid][pBeer]++;
///////
// once he uses command /beer
PlayerInfo[playerid][pBeer]--; 



Re: enum [help] - doreto - 27.08.2011

hah thanks


Re: enum [help] - [MG]Dimi - 27.08.2011

No Problem


Re: enum [help] - Gagi_Corleone - 27.08.2011

This? Just put corrdinates for buy
Код:
CMD:buybeer(playerid,params[])
{
if(!IsPlayerInRangeOfPoint(playerid,4.0,x,y,z) return SendClientMessage(playerid,-1,"Samo comment if hi out of corrdinates");//put coordinates instead of x,y,z
PlayerInfo[playerid][pBeer]++;
GivePlayerMoney(playerid, -5);//Put how much money
SendClientMessage(playerid,-1,"You bought beer");
return 1;
}



Re: enum [help] - [MG]Dimi - 27.08.2011

Quote:
Originally Posted by Gagi_Corleone
Посмотреть сообщение
This? Just put corrdinates for buy
Код:
CMD:buybeer(playerid,params[])
{
if(!IsPlayerInRangeOfPoint(playerid,4.0,x,y,z) return SendClientMessage(playerid,-1,"Samo comment if hi out of corrdinates");//put coordinates instead of x,y,z
PlayerInfo[playerid][pBeer]++;
GivePlayerMoney(playerid, -5);//Put how much money
SendClientMessage(playerid,-1,"You bought beer");
return 1;
}
Second post that you are coping things that I said. WHy?


Re: enum [help] - doreto - 27.08.2011

Quote:
Originally Posted by Gagi_Corleone
Посмотреть сообщение
This? Just put corrdinates for buy
Код:
CMD:buybeer(playerid,params[])
{
if(!IsPlayerInRangeOfPoint(playerid,4.0,x,y,z) return SendClientMessage(playerid,-1,"Samo comment if hi out of corrdinates");//put coordinates instead of x,y,z
PlayerInfo[playerid][pBeer]++;
GivePlayerMoney(playerid, -5);//Put how much money
SendClientMessage(playerid,-1,"You bought beer");
return 1;
}
i dont need more help >>[MG]Dimi help me