SA-MP Forums Archive
/SETWORLD - 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: /SETWORLD (/showthread.php?tid=279879)



/SETWORLD - boyan96 - 29.08.2011

how i can make this command /setworld and the command to set player world


Re: /SETWORLD - [MWR]Blood - 29.08.2011

pawn Код:
CMD:setworld(playerid,params[])
{
    new id, world;
    if(sscanf(params,"ui",id,world)) return SendClientMessage(playerid,-1,"USAGE: /setworld <player ID> <World ID>");
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid,-1,"ERROR: This player isn't connected!");
    SetPlayerVirtualWorld(id,world);
    return 1;
}
Uses sscanf and Ycmd.


Re: /SETWORLD - Tigerkiller - 29.08.2011

pawn Код:
CMD:setworld(playerid,params[])
{
    new world;
    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;
}



Re: /SETWORLD - Luis- - 29.08.2011

You don't need sscanf, you can just use params...

And Delux13's way is the best...


Re: /SETWORLD - boyan96 - 29.08.2011

Quote:
Originally Posted by Tigerkiller
Посмотреть сообщение
pawn Код:
CMD:setworld(playerid,params[])
{
    new world;
    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;
}
i have #include sscanf2

(6716) : error 017: undefined symbol "params" ==>> if(sscanf(params,"d",world)) return SendClientMessage(playerid,0xFF0000FF,"Use /setworld <playerid>");


Re: /SETWORLD - dreamworld - 29.08.2011

Код:
if(strcmp(cmd, "/setworld", 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 = strval(tmp);
			if (PlayerInfo[playerid][pAdmin] >= 1337)
			{
			    if(IsPlayerConnected(playa))
			    {
			        if(playa != INVALID_PLAYER_ID)
			        {
			    		GetPlayerName(playa, giveplayer, sizeof(giveplayer));
						GetPlayerName(playerid, sendername, sizeof(sendername));
						SetPlayerVirtualWorld(playa, virid);
						format(string, sizeof(string), "   You have set %s virtual world to %d.", giveplayer, virid);
						SendClientMessage(playerid, COLOR_GRAD1, string);
						format(string, sizeof(string), "   %s have set your virtual world to %d.", sendername, virid);
						SendClientMessage(playa, COLOR_GRAD1, string);
					}
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_GRAD1, "   You are not authorized to use that command!");
			}
		}
		return 1;
	}



Re: /SETWORLD - boyan96 - 29.08.2011

Quote:
Originally Posted by dreamworld
Посмотреть сообщение
Код:
if(strcmp(cmd, "/setworld", 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 = strval(tmp);
			if (PlayerInfo[playerid][pAdmin] >= 1337)
			{
			    if(IsPlayerConnected(playa))
			    {
			        if(playa != INVALID_PLAYER_ID)
			        {
			    		GetPlayerName(playa, giveplayer, sizeof(giveplayer));
						GetPlayerName(playerid, sendername, sizeof(sendername));
						SetPlayerVirtualWorld(playa, virid);
						format(string, sizeof(string), "   You have set %s virtual world to %d.", giveplayer, virid);
						SendClientMessage(playerid, COLOR_GRAD1, string);
						format(string, sizeof(string), "   %s have set your virtual world to %d.", sendername, virid);
						SendClientMessage(playa, COLOR_GRAD1, string);
					}
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_GRAD1, "   You are not authorized to use that command!");
			}
		}
		return 1;
	}
(6747) : error 017: undefined symbol "sendername" ====>>>>> GetPlayerName(playerid, sendername, sizeof(sendername));


Re: /SETWORLD - =WoR=Varth - 29.08.2011

pawn Код:
CMD:setworld(playerid,params[])
{
    if(isnull(params)) return SendClientMessage(playerid,-1,"USAGE: /setworld <World ID>");
    SetPlayerVirtualWorld(playerid,strval(params));
    return 1;
}



Re: /SETWORLD - dreamworld - 21.09.2011

Код:
new sendername[MAX_PLAYER_NAME];