SA-MP Forums Archive
Help Me !!! - 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: Help Me !!! (/showthread.php?tid=485724)



Help Me !!! - Ahmad45123 - 05.01.2014

Hey guys i want to make send position command so that it sends my current position to another player in a checkpoint
and the command will be like this

/sendpos [ custompos / mypos ]
U will understand when you read this
Код:
CMD:sendpos(playerid, params[])
{
		new Float:x, Float:y, Float:z;
		new string[128];
		new int:sendto;
        if(PlayerInfo[playerid][pAdmin] > 1) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
		if(sscanf(params, "s[32]", params))
		{
			SendClientMessage(playerid, COLOR_WHITE, "USAGE: /sendpos [option]");
			SendClientMessage(playerid, COLOR_GREY, "OPTIONS: mypos | custompos");
			return 1;
		}
		if(!strcmp(params, "mypos", true, 8))
		{
            //Give me code so that when i type '/sendpos mypos [playerid]' It Works
		}
		else if(!strcmp(params, "custompos", true, 5))
		{
			//Give me code so that when i type '/sendpos custompos [playerid] [x] [y] [z]' It Works
		}
		return 1;
}
Please Complete This Code --- I'm Beginner ---


Re: Help Me !!! - Voxel - 05.01.2014

pawn Код:
CMD:sendpos(playerid, params[])
{
        new Float:x, Float:y, Float:z;
        new string[128];
        new int:sendto;
        if(PlayerInfo[playerid][pAdmin] > 1) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
        if(sscanf(params, "s[32]", params))
        {
            SendClientMessage(playerid, COLOR_WHITE, "USAGE: /sendpos [option]");
            SendClientMessage(playerid, COLOR_GREY, "OPTIONS: mypos | custompos");
            return 1;
        }
        if(!strcmp(params, "mypos", true, 8))
        {
            GetPlayerPos(playerid, x, y, z);
            SetPlayerCheckpoint(playerid, x, y, z, 3.0);
            //not tested
        }
        else if(!strcmp(params, "custompos", true, 5))
        {
            //Try this one you're self
        }
        return 1;
}
Try the rest your self since theres no learning from copying others work,
try the samp wiki...

https://sampwiki.blast.hk/wiki/Function:SetPlayerCheckpoint
https://sampwiki.blast.hk/wiki/GetPlayerPos


Re: Help Me !!! - Ahmad45123 - 05.01.2014

Ok, but the problem is that strcmp params dont work just give me the code of strcmp

Or Give Me a Tut. on strcmp


Re: Help Me !!! - Ahmad45123 - 05.01.2014

Just Fix This :

It Keeps Showing The USAGE Message

Код:
if(sscanf(params, "s[32]", params))
        {
            SendClientMessage(playerid, COLOR_WHITE, "USAGE: /sendpos [option]");
            SendClientMessage(playerid, COLOR_GREY, "OPTIONS: mypos | custompos");
            return 1;
        }
        if(!strcmp(params, "mypos", true, 8))
        {

        }
        else if(!strcmp(params, "custompos", true, 5))
        {

        }



Re: Help Me !!! - iZN - 05.01.2014

pawn Код:
CMD:sendpos(playerid, params[])
{
        new Float:x, Float:y, Float:z;
        new string[128];
        new int:sendto;
        if(PlayerInfo[playerid][pAdmin] > 1) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
        if(sscanf(params, "s[32]", params))
        {
            SendClientMessage(playerid, COLOR_WHITE, "USAGE: /sendpos [option]");
            SendClientMessage(playerid, COLOR_GREY, "OPTIONS: mypos | custompos");
            return true;
        }
        else
        {
            if(!strcmp(params, "mypos", true, 8))
            {
                GetPlayerPos(playerid, x, y, z);
                SetPlayerCheckpoint(playerid, x, y, z, 3.0);
                //not tested
            }
            else if(!strcmp(params, "custompos", true, 5))
            {
                //Try this one you're self
            }
        }
        return true;
}



Re: Help Me !!! - Ahmad45123 - 05.01.2014

Thanks, But Isn't There A Strcmp Tut..

Or Any Thing Which I Can Use To Get Information From Players In Commands