/setworld aint working
#1

My /setworld isnt working. It doesnt set your world and it always says "World set to 0" after you set someone.

Код:
CMD:setworld(playerid,params[])
{
    new world;
    if(PlayerInfo[playerid][pAdminLevel] >= 3)
    {
	    if(sscanf(params,"d",world)) return SendClientMessage(playerid,0xFF0000FF,"Use /setworld <playerid>");
	    {
	        new s[50];
	        format(s,sizeof s,"World changed to %d",world);
	        SendClientMessage(playerid,0xFF0000FF,s);
	        SetPlayerVirtualWorld(playerid,world);
	    }
	}
    return 1;
}
Reply
#2

pawn Код:
if(strcmp(cmd, "/setvw", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /setvw [playerid/PartOfName] [virworldid]");
                return 1;
            }
            new playa;
            playa = ReturnUser(tmp);
            new virid;
            tmp = strtok(cmdtext, idx);
            virid = strvalEx(tmp);
            if (PlayerInfo[playerid][pAdmin] >= 1)
            {
                if(IsPlayerConnected(playa))
                {
                    if(playa != INVALID_PLAYER_ID)
                    {
                        if(GetPlayerState(playa) == 2)
                        {
                            GetPlayerName(playa, giveplayer, sizeof(giveplayer));

                            SetPlayerVirtualWorld(playa, virid);
                            PlayerInfo[playa][pVirWorld] = virid;
                            new vehicleid = GetPlayerVehicleID(playa);
                            SetVehicleVirtualWorld(vehicleid, GetPlayerVirtualWorld(playa));
                            format(string, sizeof(string), "** You have set %s's (%d) virtual world to %d.", giveplayer,playa, virid);
                            SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
                            format(string, sizeof(string), "~w~Admin %s ~n~~w~Has Set Your Virtual World to ~y~(%d)", sendername, virid);
                            GameTextForPlayer(playa, string, 4000, 3);
                            format(string, sizeof(string), "[ADMIN]: %s has set %s's (%d) world to %d.",sendername,giveplayer,playa,virid);
                            ABroadCast(COLOR_LIGHTRED,string, 5);
                            new y, m, d;
                            new h,mi,s;
                            getdate(y,m,d);
                            gettime(h,mi,s);
                            format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s Has Set %s's World to %d",d,m,y,h,mi,s,sendername,giveplayer,virid);
                            GiveLog(string);
                        }
                        else
                        {
                            GetPlayerName(playa, giveplayer, sizeof(giveplayer));

                            SetPlayerVirtualWorld(playa, virid);
                            PlayerInfo[playa][pVirWorld] = virid;
                            format(string, sizeof(string), "  You have set %s's (%d) virtual world to %d.", giveplayer,playa, virid);
                            SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
                            format(string, sizeof(string), "~w~Admin %s ~n~~w~Has Set Your Virtual World to ~y~(%d)", sendername, virid);
                            GameTextForPlayer(playa, string, 4000, 3);
                            format(string, sizeof(string), "[ADMIN]: %s has set %s's (%d) world to %d.",sendername,giveplayer,playa,virid);
                            ABroadCast(COLOR_LIGHTRED,string, 5);
                            new y, m, d;
                            new h,mi,s;
                            getdate(y,m,d);
                            gettime(h,mi,s);
                            format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s Has Set %s's World to %d",d,m,y,h,mi,s,sendername,giveplayer,virid);
                            GiveLog(string);
                        }
                    }
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD1, "** You are not authorized to use that command!");
            }
        }
        return 1;
This might work.
Reply
#3

pawn Код:
CMD:setworld(playerid,params[])
{
    new Player, World;
    if(PlayerInfo[playerid][pAdminLevel] < 2) return 1;

    if(sscanf(params, "ui", Player, World)) return SendClientMessage(playerid, 0xFF0000FF, "Use /setworld <playerid> <worldid>");
    else
    {
        if(!IsPlayerConnected(Player)) return SendClientMessage(playerid, 0xFF0000FF, "Player not connected!");
       
        new S[128], PlayerAdminName[MAX_PLAYER_NAME], PlayerName[MAX_PLAYER_NAME];
       
        if(Player != playerid)
        {
            GetPlayerName(playerid, PlayerAdminName, MAX_PLAYER_NAME);
            GetPlayerName(Player, PlayerName, MAX_PLAYER_NAME);
       
            format(S, 128, "You set the Virtual World of %s [ID:%d] to %d.", PlayerName, Player, World);
            SendClientMessage(playerid, 0xFF0000FF, S);

            format(S, 128, "Admin %s [ID:%d] set your Virtual World to %d.", PlayerAdminName, playerid, World);
            SendClientMessage(Player, 0xFF0000FF, S);
           
        }else
        {
            #pragma unused PlayerAdminName
            #pragma unused PlayerName
           
            format(S, 128, "You set your Virtual World to %d.", World);
            SendClientMessage(playerid, 0xFF0000FF, S);
        }

        if(GetPlayerState(Player) == PLAYER_STATE_DRIVER) SetVehicleVirtualWorld(GetPlayerVehicleID(Player), World);
        else SetPlayerVirtualWorld(Player, World);
    }
    return 1;
}
This might work.
Reply
#4

pawn Код:
CMD:setworld(playerid,params[])
{
    new world;
    if (PlayerInfo[playerid][pAdminLevel] >= 3)
    {
        if (!sscanf(params,"d",world))
        {
            new s[50];
            format(s,sizeof s,"World changed to %d",world);
            SendClientMessage(playerid,0xFF0000FF,s);
            SetPlayerVirtualWorld(playerid,world);
        }
         else SendClientMessage(playerid, 0xFF0000FF, "Use /setworld <playerid>");
    }
    return 1;
}
EDIT: Or just remove those 2 braces under if (sscanf...
Reply
#5

Uhm thanks guys, but I just need my code edited.
@Hurt still doesnt change the world mate :/
Reply
#6

How do you see whether world is changed or not? Add a sendclientmessage under setplayervitrualworld and if you receive that message, means your world is changed. Unless you can still see other players around you. That's a concrete proof it's not working.
Reply
#7

pawn Код:
CMD:setworld(playerid,params[])
{
    new targetid, world;
    if(PlayerInfo[playerid][pAdminLevel] >= 3)
    {
        if(sscanf(params,"ud", targetid, world)) return SendClientMessage(playerid,0xFF0000FF,"Use /setworld <playerid>");
        {
            new s[32];
            format(s, sizeof s, "World changed to %d", world);
            SendClientMessage(playerid, 0xFF0000FF, s);
            SetPlayerVirtualWorld(targetid, world);
        }
    }
    return 1;
}
Reply
#8

What you need?

A Admin command to change all players virtual world?, or just change the world who type the command?
Reply
#9

omg man... seems we were so dizzy hahaha, childish mistakes
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)