11.11.2012, 16:05
So i found a poison dart command id like to add to my server but it was in strcmp which im not 100% sure on how to add to my server, So i converted it to zcmd
Original Strcmp
Converted to zcmd
Does this conversion look correct? Also if i want to make it so only a member from the hitman faction could use this command, How would i implement that?
Where would i add the above code etc ^
Thanks
Original Strcmp
pawn Код:
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;
}
pawn Код:
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;
}
pawn Код:
if(!IsAHitman(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not a hitman.");
Thanks