10.11.2012, 16:30
strcmp
zcmd
Would this seem right? Also if i want the command to only be used by the faction hitman agency what would i change it too? thanks
Код:
if(strcmp(cmd, "/poisondart", true) == 0) { if(IsPlayerConnected(playerid)) { tmp = strtok(cmdtext, idx); new para1 = ReturnUser(tmp); if (PlayerInfo[playerid][pMember] == 8 || PlayerInfo[playerid][pLeader] == 8) { if (PlayerInfo[playerid][pRank] >= 5) { if(PlayerInfo[para1][pMember] == 8||PlayerInfo[para1][pLeader] == 8) { SendClientMessage(playerid,COLOR_LIGHTBLUE,"Don't poison dart your team-mates!"); return 1; } if(playerid == para1) { SendClientMessage(playerid,COLOR_LIGHTBLUE,"I don't think you want to poison yourself!"); return 1; } else if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /poisondart [playerid/PartOfName]"); return 1; } if(IsPlayerConnected(para1)) { if(para1 != INVALID_PLAYER_ID) { if (!(ProxDetectorS(10.0, playerid, giveplayerid))) { SendClientMessage(playerid, COLOR_WHITE, "Your target is too far."); } else { GetPlayerName(para1, sendername, sizeof(sendername)); format(string, sizeof(string), "You have shot a poison dart into %s's neck",sendername); SendClientMessage(playerid,COLOR_LIGHTBLUE,string); SetTimer("Target",6000,0); } } else { format(string, sizeof(string), "That person isn't online!"); SendClientMessage(playerid, COLOR_LIGHTBLUE, string); } } } else { SendClientMessage(playerid, COLOR_GRAD1, "You are not allowed to use that command!"); } } return 1; } return 1; }
Код:
CMD:poisondart(playerid, params[]) { if(IsPlayerConnected(playerid)) { tmp = strtok(cmdtext, idx); new para1 = ReturnUser(tmp); if (PlayerInfo[playerid][pMember] == 8 || PlayerInfo[playerid][pLeader] == 8) { if (PlayerInfo[playerid][pRank] >= 5) { if(PlayerInfo[para1][pMember] == 8||PlayerInfo[para1][pLeader] == 8) { SendClientMessage(playerid,COLOR_LIGHTBLUE,"Don't poison dart your team-mates!"); return 1; } if(playerid == para1) { SendClientMessage(playerid,COLOR_LIGHTBLUE,"I don't think you want to poison yourself!"); return 1; } else if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /poisondart [playerid/PartOfName]"); return 1; } if(IsPlayerConnected(para1)) { if(para1 != INVALID_PLAYER_ID) { if (!(ProxDetectorS(10.0, playerid, giveplayerid))) { SendClientMessage(playerid, COLOR_WHITE, "Your target is too far."); } else { GetPlayerName(para1, sendername, sizeof(sendername)); format(string, sizeof(string), "You have shot a poison dart into %s's neck",sendername); SendClientMessage(playerid,COLOR_LIGHTBLUE,string); SetTimer("Target",6000,0); } } else { format(string, sizeof(string), "That person isn't online!"); SendClientMessage(playerid, COLOR_LIGHTBLUE, string); } } } else { SendClientMessage(playerid, COLOR_GRAD1, "You are not allowed to use that command!"); } } return 1; } return 1; }