26.11.2010, 22:12
(
Последний раз редактировалось Haegon; 01.12.2010 в 02:23.
)
Hello! Thanks for taking a peek at my post.
I've search far and wide through the forums for some relevant information on my problem, but to no avail. All of the posts I seen pertained to strcmp commands.
I am attempt to make a /sellgun command. The syntax I am aiming for is "/sellgun (target ID) (gun name)", but when typed without the last 2 parameters, gives a list of guns you can make. I am not sure how to get my code to check for those extra parameters, or even recognize them.
I have tons of commands in my script that are already dcmd, so I would prefer to keep them dcmd. I do not use sscanf or zcmd.
Here is my code:
Any help is much appreciated!
- Haegon
I've search far and wide through the forums for some relevant information on my problem, but to no avail. All of the posts I seen pertained to strcmp commands.
I am attempt to make a /sellgun command. The syntax I am aiming for is "/sellgun (target ID) (gun name)", but when typed without the last 2 parameters, gives a list of guns you can make. I am not sure how to get my code to check for those extra parameters, or even recognize them.
I have tons of commands in my script that are already dcmd, so I would prefer to keep them dcmd. I do not use sscanf or zcmd.
Here is my code:
Код:
dcmd_sellgun(playerid, params[]) { new string[64], PlayerName[24]; new tmp[256], tmp2[256], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index); new number; new StringLength; new id; GetPlayerName(playerid, PlayerName, sizeof(PlayerName)); format(string, sizeof(string),"xadmin/Users/%s.ini", udb_encode(PlayerName)); number = dini_Int(string, "Job"); StringLength = strlen(params); id = ReturnPlayerID(tmp); if(number == 6) { if(StringLength == 7) { SendClientMessage(playerid, CHAT_COLOR_RED, "Works"); } else if(id == INVALID_PLAYER_ID) { SendClientMessage(playerid, CHAT_COLOR_RED, "Invalid Player ID!"); } else { SendClientMessage(playerid, CHAT_COLOR_RED, "Test"); } } else if(number != 6) { SendClientMessage(playerid, CHAT_COLOR_RED, "You are not a Arms Dealer!"); } return 1; }
- Haegon