Command not working - 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: Command not working (
/showthread.php?tid=616676)
Command not working -
AndreiWow - 08.09.2016
Код:
if(strcmp(cmd, "/setleader", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "Function: {FFFFFF}/setleader [ID or Name/Part of name] [Number(1-8)]");
return 1;
}
new playa = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
new level = strval(tmp);
if(level < 1 || level > 8) { SendClientMessage(playerid, COLOR_GREY, "Function: {FFFFFF}/From [1-8]"); return 1; }
if (PlayerInfo[playerid][pAdmin] >= 1337)
{
if(IsPlayerConnected(playa))
{
if(playa != INVALID_PLAYER_ID)
{
if(PlayerInfo[playa][pMember] > 0)
{
SendClientMessage(playerid, COLOR_GREY, "That player is in a Faction");
return 1;
}
GetPlayerName(playa, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
PlayerInfo[playa][pLeader] = level;
PlayerInfo[playa][pMember] = level;
format(string, sizeof(string), "You Are Now A Faction Leader by Admin %s", sendername);
SendClientMessage(playa, COLOR_LIGHTRED, string);
format(string, sizeof(string), "You have given %s control to run Faction Number %d", giveplayer,level);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
if(level == 1) { PlayerInfo[playa][pChar] = 288; PlayerInfo[playa][pRank] = 8; } //Police Force
else if(level == 2) { PlayerInfo[playa][pChar] = 286; PlayerInfo[playa][pRank] = 8; } //FBI/ATF
else if(level == 3) { PlayerInfo[playa][pChar] = 186; PlayerInfo[playa][pRank] = 8; } //Triads
else if(level == 4) { PlayerInfo[playa][pChar] = 111; PlayerInfo[playa][pRank] = 8; } //Bonanno
else if(level == 5) { PlayerInfo[playa][pChar] = 113; PlayerInfo[playa][pRank] = 8; } //Salvatore
else if(level == 6) { PlayerInfo[playa][pChar] = 294; PlayerInfo[playa][pRank] = 8; } //Hitmans
else if(level == 7) { PlayerInfo[playa][pChar] = 61; PlayerInfo[playa][pRank] = 8; } //Taxi Cab Company
else if(level == 8) { PlayerInfo[playa][pChar] = 107; PlayerInfo[playa][pRank] = 8; } //424JF Gang
SetPlayerSkin(playa, PlayerInfo[playa][pChar]);
UpdatePlayerInfo(playa);
SetPlayerSpawn(playa);
}
}//not connected
}
}
return 1;
}
Nothing happens if I type in the ID and the id of the faction
Re: Command not working -
AndreiWow - 09.09.2016
Help please?
Re: Command not working -
AndreiWow - 09.09.2016
someone please.. atleast re-write it to work..
Re: Command not working -
Dejan12345 - 09.09.2016
use mine command with zcmd and sscanf
Код:
CMD:makeleader(playerid,params[])
{
new string[128], igrac, giveplayerid, giveplayer[MAX_PLAYER_NAME], level, sendername[MAX_PLAYER_NAME];
GetPlayerName(playerid, sendername, sizeof(sendername));
if(IsPlayerAdmin(playerid))
{
if(!sscanf(params, "ui", giveplayerid, level))
{
PlayerInfo[igrac][pRank] = 6;
PlayerInfo[igrac][pMember] = 0;
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
if(giveplayerid == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1,"Pogresan igracev id");
PlayerInfo[giveplayerid][pLeader] = level;
format(string, sizeof(string), "Dao si igracu %s lidera organizacije %i", giveplayer, level);
SendClientMessage(playerid, -1, string);
format(string, sizeof(string), "Admin %s ti je dao lidera organizacije %i", sendername, level);
SendClientMessage(giveplayerid, -1, string);
if(level == 0) { PlayerInfo[giveplayerid][pSkin] = 0; PlayerInfo[giveplayerid][pRank] = 0; return 1; }
else if(level == 1) { PlayerInfo[giveplayerid][pSkin] = 288; } //Policija
SetPlayerSkin(giveplayerid,PlayerInfo[giveplayerid][pSkin]);
}
else SendClientMessage(playerid, -1,"Koristenje /makeleader [IDigraca/Dio imena] [broj(1-2)]");
}
else SendClientMessage(playerid, -1,"Niste ovlasteni da koristite ovu komandu");
return 1;
}
edit this where is something not on english to you want
Re: Command not working -
Skimmer - 10.09.2016
Are you sure your admin level is 1337 or higher?
pawn Код:
if (PlayerInfo[playerid][pAdmin] >= 1337)