16.09.2014, 18:26
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;
}
}