Hey guys. problem over here -
bartje01 - 01.06.2010
Hey guys I'm working on a drugs script but I want to be able to deal your drugs/
like /dealweed [id] [amount] [price]
I know how to just GIVE one weed to someone.
that would be somethnig like this:
Код:
dcmd_dealweed(playerid, params[])
{
if(PlayerInfo[playerid][Drugs] >= 1)
{
new tmp[256], tmp2[256], Index;
tmp = strtok(params,Index),
tmp2 = strtok(params,Index);
if(!strlen(params)) return SendClientMessage(playerid, red, "USAGE: /dealweed [playerid]");
new player1,playername[MAX_PLAYER_NAME], string[128];
player1 = strval(tmp);
if(!strlen(tmp2)) return SendClientMessage(playerid, red, "USAGE: /dealweed [playerid]");
GetPlayerName(player1,playername,sizeof(playername));
format(string,sizeof(string),"You gived %s 1 weed",playername);
SendClientMessage(playerid,red,string);
PlayerInfo[player1][GSF] += 1;
SendClientMessage(player1,red,"You have +1 weed");
}
else SendClientMessage(playerid,red,"You don't have weed");
return 1;
}
}
But know I wanna make it like /dealweed [id] [amount] [price].
And the other one needs to /accept it.
Can someone please help me out and give a little explanation so I will learn something from it?
Thanks in Advance!
Re: Hey guys. problem over here -
bartje01 - 02.06.2010
anyone?
Re: Hey guys. problem over here -
DJDhan - 02.06.2010
Well, right now, all you need to do is add one more tmp.
Код:
dcmd_dealweed(playerid, params[])
{
if(PlayerInfo[playerid][Drugs] >= 1)
{
new tmp[25], tmp2[25],tmp3[25], Index,amount,price;
tmp = strtok(params,Index),
tmp2 = strtok(params,Index);
tmp3 = strtok(params,Index);
if(!strlen(tmp) || !strlen(tmp2) || !strlen(tmp3)) return SendClientMessage(playerid, red, "USAGE: /dealweed [playerid]");
new player1,playername[MAX_PLAYER_NAME], string[128];
player1 = strval(tmp);
amount=strval(tmp2);
price= strval(tmp3);
GetPlayerName(player1,playername,sizeof(playername));
format(string,sizeof(string),"You gave %s %d weed",playername,amount);
SendClientMessage(playerid,red,string);
PlayerInfo[player1][GSF] += amount;
SendClientMessage(player1,red,"You have +%d weed",amount);
GivePlayerMoney(playerid,GetPlayerMoney(playerid)+price);
GivePlayerMoney(player1,GetPlayerMoney(playerid)-price);
}
else SendClientMessage(playerid,red,"You don't have weed");
return 1;
}
}
Re: Hey guys. problem over here -
bartje01 - 02.06.2010
Thanks, but. I know also need a /accept command wich is much more difficult in my eyes xD So you don't just go to random people and type /dealweed (id) (amount) (1999999) and you are richxD
Re: Hey guys. problem over here -
bartje01 - 02.06.2010
and oh noes!
Код:
C:\Users\Bart\Desktop\SAMP FRESH LIFE\filterscripts\ladmin4v2.pwn(4804) : error 047: array sizes do not match, or destination array is too small
C:\Users\Bart\Desktop\SAMP FRESH LIFE\filterscripts\ladmin4v2.pwn(4804 -- 4805) : error 047: array sizes do not match, or destination array is too small
C:\Users\Bart\Desktop\SAMP FRESH LIFE\filterscripts\ladmin4v2.pwn(4806) : error 047: array sizes do not match, or destination array is too small
C:\Users\Bart\Desktop\SAMP FRESH LIFE\filterscripts\ladmin4v2.pwn(4819) : warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
3 Errors.
Re: Hey guys. problem over here -
DJDhan - 02.06.2010
Increase the array sizes of tmp,tmp2 and tmp3 to 128.