Posion Dart - 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: Posion Dart (
/showthread.php?tid=391776)
Posion Dart -
Pawnstar - 11.11.2012
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
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;
}
Converted to zcmd
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;
}
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?
pawn Код:
if(!IsAHitman(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not a hitman.");
Where would i add the above code etc ^
Thanks
Re: Posion Dart -
Dubya - 11.11.2012
pawn Код:
CMD:poisondart(playerid, params[])
{
if(IsPlayerConnected(playerid))
{
if(!IsAHitman(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not a hitman.");
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;
}
Re: Posion Dart -
Pawnstar - 11.11.2012
Код:
C:\Users\Ash.Ash-PC\Desktop\traa\gamemodes\TRP.pwn(5026) : error 017: undefined symbol "tmp"
C:\Users\Ash.Ash-PC\Desktop\traa\gamemodes\TRP.pwn(5026) : error 017: undefined symbol "cmdtext"
C:\Users\Ash.Ash-PC\Desktop\traa\gamemodes\TRP.pwn(5027) : error 017: undefined symbol "ReturnUser"
C:\Users\Ash.Ash-PC\Desktop\traa\gamemodes\TRP.pwn(5028) : error 017: undefined symbol "pMember"
C:\Users\Ash.Ash-PC\Desktop\traa\gamemodes\TRP.pwn(5030) : error 017: undefined symbol "pRank"
C:\Users\Ash.Ash-PC\Desktop\traa\gamemodes\TRP.pwn(5032) : error 017: undefined symbol "pMember"
C:\Users\Ash.Ash-PC\Desktop\traa\gamemodes\TRP.pwn(5037) : warning 217: loose indentation
C:\Users\Ash.Ash-PC\Desktop\traa\gamemodes\TRP.pwn(5042) : warning 217: loose indentation
C:\Users\Ash.Ash-PC\Desktop\traa\gamemodes\TRP.pwn(5042) : error 017: undefined symbol "tmp"
C:\Users\Ash.Ash-PC\Desktop\traa\gamemodes\TRP.pwn(5051) : error 017: undefined symbol "ProxDetectorS"
C:\Users\Ash.Ash-PC\Desktop\traa\gamemodes\TRP.pwn(5057) : error 017: undefined symbol "sendername"
C:\Users\Ash.Ash-PC\Desktop\traa\gamemodes\TRP.pwn(5057) : error 017: undefined symbol "sendername"
C:\Users\Ash.Ash-PC\Desktop\traa\gamemodes\TRP.pwn(5057) : error 029: invalid expression, assumed zero
C:\Users\Ash.Ash-PC\Desktop\traa\gamemodes\TRP.pwn(5057) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
12 Errors.
Re: Posion Dart -
Pawnstar - 13.11.2012
Still need help please