Help me on this command please - 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: Help me on this command please (
/showthread.php?tid=537620)
Help me on this command please -
Mikkel_RE - 16.09.2014
Hey, can anyone tell me why this code doesnt Work, the command is for making "A materials" to less "D materials" but when i type /refine a 100, it will give me like 10206454 D materials (just an example) please help me, here is the code.
pawn Код:
if(strcmp(cmd, "/refine", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if (PlayerInfo[playerid][pJob] != 2 && !(PlayerInfo[playerid][pAdmin] & ADMIN_ACCESS))
{
SendClientMessage(playerid, 0xAFAFAFAA, " You are not a Material Handler!");
return 1;
}
tmp = strtok(cmdtext,idx);
if(strlen(tmp))
{
if(!strcmp(tmp, "a", true))
{
tmp = strtok(cmdtext,idx);
new result = strval(tmp);
if(result < 100 || result > PlayerInfo[playerid][pMats])
{
format(string, 256, "USAGE: /refine a [%d A mats]", PlayerInfo[playerid][pMats]);
SendClientMessage(playerid, 0xBFC0C2FF, string);
return 1;
}
PlayerInfo[playerid][pMats] = PlayerInfo[playerid][pMats] - result;
new Float:dmats = floatround(result / 20.0, 0);
PlayerInfo[playerid][pMatsd] = dmats + PlayerInfo[playerid][pMatsd];
format(string, 256, "you have created %d D materials from %d A materials.", dmats, result);
SendClientMessage(playerid, 0xAFAFAFAA, string);
return 1;
}
}
SendClientMessage(playerid, 0xBFC0C2FF, "USAGE: /refine [a/b/c] [ammount]");
return 1;
}
}
Re: Help me on this command please -
Rodney Francalim - 16.09.2014
Why don't you use ZCMD + sscanf?
It would be more easy help you.
Re : Help me on this command please -
streetpeace - 16.09.2014
Use a code like this
pawn Код:
PlayerInfo[playerid][pMatsd] += (your value);
Your value will be added to the last one, this is your question I think ?
Re: Help me on this command please -
Mikkel_RE - 16.09.2014
I still have the same problem
Re: Help me on this command please -
Mikkel_RE - 16.09.2014
Nevermind, i fixed it by myself