ned help with /setleader
#1

Hello!

im trying to make a /setleader cmd, but it only works on my self to set me at the coords with the command when i use it, but if the player i make leader rejoin the server, he spawns at the right place after login.

What im i doing wrong?
Reply
#2

show us the code
Reply
#3

Quote:
Originally Posted by TheLazySloth
Посмотреть сообщение
show us the code
Oh..forgot to paste it -_-

Code:
pawn Код:
CMD:setleader( playerid, params[ ] )
{
    if ( GetPVarInt( playerid, "Level" ) < 3 && !IsPlayerAdmin( playerid ) )
        return SendClientMessage( playerid, -1, "You are not allowed to use this command");

    if ( sscanf( params, "ui", params[ 0 ], params[ 1 ] ) )
        return SendClientMessage( playerid, -1, ""COL_LIGHTBLUE"Usage:{FFFFFF} /setleader [PlayerID] [TeamID 1 - 3] Teams: ID 1: Airwolves. ID 2: Bluefoxes. ID 3: Thunderbirds"),SendClientMessage( playerid, -1, "-Check "COL_LIGHTBLUE"/levelranks{FFFFFF} to view each level's name");

    if ( !IsPlayerConnected( params[ 0 ] ) )
        return SendClientMessage( playerid, -1, ""COL_RED"Player is not connected");

    if ( params[ 1 ] < 0 || params[ 1 ] > 3 )
        return SendClientMessage( playerid, -1, "You must insert from ID "COL_LIGHTBLUE"0{FFFFFF} to "COL_LIGHTBLUE"3{FFFFFF}");

    if ( GetPVarInt( playerid, "Level" ) < GetPVarInt( params[ 0 ], "Level" ) )
        return SendClientMessage( playerid, -1, "You are not allowed to use this command on this admin."),SendClientMessage( playerid, -1, "REASON: Player is higher in grade than you.");


    SetPVarInt( params[ 0 ], "Leader", params[ 1 ] );
    new String[ 256 ];
    new id;
    if ( GetPVarInt( playerid, "Leader" ) == 0 )
    {
        ResetPlayerWeapons(playerid);
        GivePlayerWeapon(playerid,35,60); //Rocket Launcher
        GivePlayerWeapon(playerid,30,200); //AK-47
        SetPlayerColor(playerid,COLOR_RED);
        SetPlayerPos(playerid, 414.6559,2531.7651,19.1601);
        SetPlayerTeam(playerid, 0);
        SetPVarInt( params[ 0 ], "Leader", 0 );
        format( String, sizeof String, "You made yourself leader of nothing!", params[ 1 ], GetPlayerLevelName( playerid ) );
        SendClientMessage( playerid, -1, String );
    }
    else if ( GetPVarInt( playerid, "Leader" ) == 1 )
    {
        SetPlayerColor(playerid,COLOR_GREY);
        SetPlayerSkin(playerid, 61);
        SetPlayerTeam(playerid, 1);
        SetPVarInt( params[ 0 ], "Leader", 1 );
        SetPlayerPos(playerid, 1607.7803,1169.4840,14.2188);
        GivePlayerWeapon(playerid,35,60); //Rocket Launcher
        GivePlayerWeapon(playerid,26,100); //Sawn-off Shotgun
        GivePlayerWeapon(playerid,30,200); //AK-47
        SetPlayerSkillLevel(playerid, WEAPONSKILL_SAWNOFF_SHOTGUN, 999);
        SetPlayerSkillLevel(playerid, WEAPONSKILL_AK47, 999);
        format( String, sizeof String, "You made yourself leader of Airwolves!", params[ 1 ], GetPlayerLevelName( playerid ) );
        SendClientMessage( playerid, -1, String );
    }
    else if ( GetPVarInt( playerid, "Leader" ) == 2 )
    {
        SetPlayerColor(playerid,COLOR_DBLUE);
        SetPlayerTeam(playerid, 2);
        SetPlayerSkin(playerid, 61);
        SetPVarInt( params[ 0 ], "Leader", 2 );
        SetPlayerPos(playerid, 1998.3118,-2352.3438,13.5469);
        GivePlayerWeapon(playerid,35,60); //Rocket Launcher
        GivePlayerWeapon(playerid,26,100); //Sawn-off Shotgun
        GivePlayerWeapon(playerid,30,200); //AK-47
        SetPlayerSkillLevel(playerid, WEAPONSKILL_SAWNOFF_SHOTGUN, 999);
        SetPlayerSkillLevel(playerid, WEAPONSKILL_AK47, 999);
        format( String, sizeof String, "You made yourself leader of Bluefoxes!", params[ 1 ], GetPlayerLevelName( playerid ) );
        SendClientMessage( playerid, -1, String );
    }
    else if ( GetPVarInt( playerid, "Leader" ) == 3 )
    {
        SetPlayerColor(playerid,COLOR_YELLOW);
        SetPlayerTeam(playerid, 3);
        SetPlayerSkin(playerid, 61);
        SetPVarInt( params[ 0 ], "Leader", 3 );
        SetPlayerPos(playerid, -687.5341,425.3484,11.5729);
        GivePlayerWeapon(playerid,35,60); //Rocket Launcher
        GivePlayerWeapon(playerid,26,100); //Sawn-off Shotgun
        GivePlayerWeapon(playerid,30,200); //AK-47
        SetPlayerSkillLevel(playerid, WEAPONSKILL_SAWNOFF_SHOTGUN, 999);
        SetPlayerSkillLevel(playerid, WEAPONSKILL_AK47, 999);
        format( String, sizeof String, "You made yourself leader of Thunderbirds!", params[ 1 ], GetPlayerLevelName( playerid ) );
        SendClientMessage( playerid, -1, String );
     }
    return 1;
}
Reply
#4

Anyone have a clue?
Reply
#5

Код:
}
	if(strcmp(cmd, "/makeleader", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_WHITE, "USAGE: /makeleader [playerid/PartOfName] [number]");
				return 1;
			}
			new para1;
			para1 = ReturnUser(tmp);
			if(IsPlayerNPC(para1)) return 1;
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_WHITE, "USAGE: /makeleader [playerid/PartOfName] [number]");
				return 1;
			}
			new faction;
			faction = strvalEx(tmp);
			if(faction < 0 || faction > 12) { SendClientMessage(playerid, COLOR_GREY, "   Dont go below number 0, or above number 12 !"); return 1; }
			if(PlayerInfo[playerid][pAdmin] >= 1337 || (PlayerInfo[playerid][pFactionMod]))
			{
			    if(IsPlayerConnected(para1))
			    {
			        if(para1 != INVALID_PLAYER_ID)
			        {
			            new ftext[20];
			            GetPlayerName(playerid, sendername, sizeof(sendername));
			            GetPlayerName(para1, giveplayer, sizeof(giveplayer));
						if(faction == 0) { PlayerInfo[para1][pModel] = 299; PlayerInfo[para1][pRank] = 0; ftext = "None"; }
						else if(faction == 1) { PlayerInfo[para1][pModel] = 265; PlayerInfo[para1][pRank] = 6; ftext = "Police Force"; }
						else if(faction == 2) { PlayerInfo[para1][pModel] = 286; PlayerInfo[para1][pRank] = 6; ftext = "FBI"; }
						else if(faction == 3) { PlayerInfo[para1][pModel] = 288; PlayerInfo[para1][pRank] = 6; ftext = "SASP"; }
						else if(faction == 4) { PlayerInfo[para1][pModel] = 274; PlayerInfo[para1][pRank] = 6; ftext = "Firemen/Ambulance"; }
						else if(faction == 5) { PlayerInfo[para1][pModel] = 287; PlayerInfo[para1][pRank] = 6; ftext = "National Guards"; }
						else if(faction == 6) { PlayerInfo[para1][pModel] = 147; PlayerInfo[para1][pRank] = 6; ftext = "Senate"; }
						else if(faction == 7) { PlayerInfo[para1][pModel] = 165; PlayerInfo[para1][pRank] = 6; ftext = "Secret Society"; }
						else if(faction == 8) { PlayerInfo[para1][pModel] = 294; PlayerInfo[para1][pRank] = 6; ftext = "Hitman Agency"; }
						else if(faction == 9) { PlayerInfo[para1][pModel] = 227; PlayerInfo[para1][pRank] = 8; ftext = "News Agency"; }
						else if(faction == 10) { PlayerInfo[para1][pModel] = 61; PlayerInfo[para1][pRank] = 6; ftext = "Taxi Cab Company"; }
						else if(faction == 11) { PlayerInfo[para1][pModel] = 240; PlayerInfo[para1][pRank] = 6; ftext = "Administrators"; }
						else if(faction == 12) { PlayerInfo[para1][pModel] = 240; PlayerInfo[para1][pRank] = 6; ftext = "Airforce"; }
						format(string, sizeof(string), "* You have given %s leadership of the %s.", giveplayer,ftext);
						SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
						format(string, sizeof(string), "* %s has given you leadership of the %s.",sendername,ftext);
						SendClientMessage(para1, COLOR_LIGHTBLUE, string);
						PlayerInfo[para1][pLeader] = faction;
						PlayerInfo[para1][pMember] = faction;
					    SetPlayerSkin(para1, PlayerInfo[para1][pModel]);
					    SetPlayerToTeamColor(playerid);
					    OnPlayerSave(para1);
					}
				}
			}
			else
			{
			SendClientMessage(playerid, COLOR_GRAD1, "   You are not authorized to use that command !");
			}
		}
		return 1;
This is the system I have in mine just remove the case 11 and case 12 because those are two custom factions I made, but I am not sure if it will work for you because I may have diffrent admin stuff ect. Try it out.

Hope I helped.

[EDIT] Just re read your code and mine probably isn't going to help you, sorry I tried.
Reply
#6

Quote:
Originally Posted by Tye Huntley
Посмотреть сообщение
Код:
}
	if(strcmp(cmd, "/makeleader", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_WHITE, "USAGE: /makeleader [playerid/PartOfName] [number]");
				return 1;
			}
			new para1;
			para1 = ReturnUser(tmp);
			if(IsPlayerNPC(para1)) return 1;
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_WHITE, "USAGE: /makeleader [playerid/PartOfName] [number]");
				return 1;
			}
			new faction;
			faction = strvalEx(tmp);
			if(faction < 0 || faction > 12) { SendClientMessage(playerid, COLOR_GREY, "   Dont go below number 0, or above number 12 !"); return 1; }
			if(PlayerInfo[playerid][pAdmin] >= 1337 || (PlayerInfo[playerid][pFactionMod]))
			{
			    if(IsPlayerConnected(para1))
			    {
			        if(para1 != INVALID_PLAYER_ID)
			        {
			            new ftext[20];
			            GetPlayerName(playerid, sendername, sizeof(sendername));
			            GetPlayerName(para1, giveplayer, sizeof(giveplayer));
						if(faction == 0) { PlayerInfo[para1][pModel] = 299; PlayerInfo[para1][pRank] = 0; ftext = "None"; }
						else if(faction == 1) { PlayerInfo[para1][pModel] = 265; PlayerInfo[para1][pRank] = 6; ftext = "Police Force"; }
						else if(faction == 2) { PlayerInfo[para1][pModel] = 286; PlayerInfo[para1][pRank] = 6; ftext = "FBI"; }
						else if(faction == 3) { PlayerInfo[para1][pModel] = 288; PlayerInfo[para1][pRank] = 6; ftext = "SASP"; }
						else if(faction == 4) { PlayerInfo[para1][pModel] = 274; PlayerInfo[para1][pRank] = 6; ftext = "Firemen/Ambulance"; }
						else if(faction == 5) { PlayerInfo[para1][pModel] = 287; PlayerInfo[para1][pRank] = 6; ftext = "National Guards"; }
						else if(faction == 6) { PlayerInfo[para1][pModel] = 147; PlayerInfo[para1][pRank] = 6; ftext = "Senate"; }
						else if(faction == 7) { PlayerInfo[para1][pModel] = 165; PlayerInfo[para1][pRank] = 6; ftext = "Secret Society"; }
						else if(faction == 8) { PlayerInfo[para1][pModel] = 294; PlayerInfo[para1][pRank] = 6; ftext = "Hitman Agency"; }
						else if(faction == 9) { PlayerInfo[para1][pModel] = 227; PlayerInfo[para1][pRank] = 8; ftext = "News Agency"; }
						else if(faction == 10) { PlayerInfo[para1][pModel] = 61; PlayerInfo[para1][pRank] = 6; ftext = "Taxi Cab Company"; }
						else if(faction == 11) { PlayerInfo[para1][pModel] = 240; PlayerInfo[para1][pRank] = 6; ftext = "Administrators"; }
						else if(faction == 12) { PlayerInfo[para1][pModel] = 240; PlayerInfo[para1][pRank] = 6; ftext = "Airforce"; }
						format(string, sizeof(string), "* You have given %s leadership of the %s.", giveplayer,ftext);
						SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
						format(string, sizeof(string), "* %s has given you leadership of the %s.",sendername,ftext);
						SendClientMessage(para1, COLOR_LIGHTBLUE, string);
						PlayerInfo[para1][pLeader] = faction;
						PlayerInfo[para1][pMember] = faction;
					    SetPlayerSkin(para1, PlayerInfo[para1][pModel]);
					    SetPlayerToTeamColor(playerid);
					    OnPlayerSave(para1);
					}
				}
			}
			else
			{
			SendClientMessage(playerid, COLOR_GRAD1, "   You are not authorized to use that command !");
			}
		}
		return 1;
This is the system I have in mine just remove the case 11 and case 12 because those are two custom factions I made, but I am not sure if it will work for you because I may have diffrent admin stuff ect. Try it out.

Hope I helped.

[EDIT] Just re read your code and mine probably isn't going to help you, sorry I tried.
This isnt ZCMD/sscanf code, so it will not help yes
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)