ZCMD problem? - 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: ZCMD problem? (
/showthread.php?tid=349942)
ZCMD problem? -
N0FeaR - 10.06.2012
Код:
../gamemodes/OnPlayerCommandZCMD.pwn(3496) : warning 217: loose indentation
../gamemodes/OnPlayerCommandZCMD.pwn(3498) : warning 209: function "cmd_givegunlicense" should return a value
../gamemodes/OnPlayerCommandZCMD.pwn(3499) : error 010: invalid function or declaration
pawn Код:
}
CMD:givegunlicense(playerid, params[])
{
if(Died[playerid] == 1) { SendClientMessage(playerid, COLOR_WHITE, "Cannot use this command while dead."); return 1; }
if(PlayerInfo[playerid][pFaction] == 1 && PlayerInfo[playerid][pRank] <= 2 || PlayerInfo[playerid][pAdministrator] > 0)
{
if(!strlen(params))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /giveweaponlicense [playerid/partofname]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if(IsPlayerConnected(giveplayerid))
{
new Float:NearYou[3];
GetPlayerPos(giveplayerid, NearYou[0], NearYou[1], NearYou[2]);
if(!IsPlayerInRangeOfPoint(playerid, 1.0, NearYou[0], NearYou[1], NearYou[2])) //1.0 is the range, try changing it if you don't like 1.0
{
SendClientMessage(playerid,-1,"You must be near the player!");
return 1;
}
if(giveplayerid != INVALID_PLAYER_ID)
{
new wep1[128];
PlayerInfo[giveplayerid][pWepLic] = 1;
format(wep1, sizeof(wep1), "gives %s a weapon license.",GetPlayerNameEx(giveplayerid));
PlayerActionMessage(playerid,15.0,wep1);
new give1[128];
format(give1, sizeof(give1), "You have given %s a weapon license.", GetPlayerNameEx(giveplayerid));
SendClientMessage(playerid, COLOR_WHITE, give1);
}
else
{
SendClientMessage(playerid, COLOR_LIGHTRED, "Playerid is not an active playerid");
}
}
else
{
SendClientMessage(playerid, COLOR_LIGHTRED, "WARNING: You do not have access to this command.");
}
}
}
return 1;
}
Re: ZCMD problem? -
Dubya - 10.06.2012
Try this:
pawn Код:
CMD:givegunlicense(playerid, params[])
{
if(Died[playerid] == 1) { SendClientMessage(playerid, COLOR_WHITE, "Cannot use this command while dead."); return 1; }
if(PlayerInfo[playerid][pFaction] == 1 && PlayerInfo[playerid][pRank] <= 2 || PlayerInfo[playerid][pAdministrator] > 0)
{
if(!strlen(params))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /giveweaponlicense [playerid/partofname]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if(IsPlayerConnected(giveplayerid))
{
new Float:NearYou[3];
GetPlayerPos(giveplayerid, NearYou[0], NearYou[1], NearYou[2]);
if(!IsPlayerInRangeOfPoint(playerid, 1.0, NearYou[0], NearYou[1], NearYou[2])) //1.0 is the range, try changing it if you don't like 1.0
{
SendClientMessage(playerid,-1,"You must be near the player!");
return 1;
}
if(giveplayerid != INVALID_PLAYER_ID)
{
new wep1[128];
PlayerInfo[giveplayerid][pWepLic] = 1;
format(wep1, sizeof(wep1), "gives %s a weapon license.",GetPlayerNameEx(giveplayerid));
PlayerActionMessage(playerid,15.0,wep1);
new give1[128];
format(give1, sizeof(give1), "You have given %s a weapon license.", GetPlayerNameEx(giveplayerid));
SendClientMessage(playerid, COLOR_WHITE, give1);
}
else
{
SendClientMessage(playerid, COLOR_LIGHTRED, "Playerid is not an active playerid");
}
}
else
{
SendClientMessage(playerid, COLOR_LIGHTRED, "WARNING: You do not have access to this command.");
}
}
return 1;
}
Re: ZCMD problem? -
Rudy_ - 10.06.2012
Nope, this will remove the 2nd warning
pawn Код:
CMD:givegunlicense(playerid, params[])
{
if(Died[playerid] == 1) { SendClientMessage(playerid, COLOR_WHITE, "Cannot use this command while dead."); return 1; }
if(PlayerInfo[playerid][pFaction] == 1 && PlayerInfo[playerid][pRank] <= 2 || PlayerInfo[playerid][pAdministrator] > 0)
{
if(!strlen(params))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /giveweaponlicense [playerid/partofname]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if(IsPlayerConnected(giveplayerid))
{
new Float:NearYou[3];
GetPlayerPos(giveplayerid, NearYou[0], NearYou[1], NearYou[2]);
if(!IsPlayerInRangeOfPoint(playerid, 1.0, NearYou[0], NearYou[1], NearYou[2])) //1.0 is the range, try changing it if you don't like 1.0
{
SendClientMessage(playerid,-1,"You must be near the player!");
return 1;
}
if(giveplayerid != INVALID_PLAYER_ID)
{
new wep1[128];
PlayerInfo[giveplayerid][pWepLic] = 1;
format(wep1, sizeof(wep1), "gives %s a weapon license.",GetPlayerNameEx(giveplayerid));
PlayerActionMessage(playerid,15.0,wep1);
new give1[128];
format(give1, sizeof(give1), "You have given %s a weapon license.", GetPlayerNameEx(giveplayerid));
SendClientMessage(playerid, COLOR_WHITE, give1);
}
else
{
SendClientMessage(playerid, COLOR_LIGHTRED, "Playerid is not an active playerid");
}
}
else
{
SendClientMessage(playerid, COLOR_LIGHTRED, "WARNING: You do not have access to this command.");
}
return 1;
}
}
return 0;
}
which line is "invalid function or declaration" and lose indentation?