Need a Command "/gotopos" or "/setpos"
#1

If tryd to make this several times, But if failed,
Because im pretty new in this i would appericiate it if you can make the Entire Pawno Code for /gotopos or /setpos.

This is how i usaly go to an possition, Like, /gotols:

Код:
    if(strcmp(cmd, "/gotols", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			if(PlayerInfo[playerid][pAdmin] >= 1)
			{
				if (GetPlayerState(playerid) == 2)
				{
					new tmpcar = GetPlayerVehicleID(playerid);
					DOO_SetVehiclePos(tmpcar, 1529.6,-1691.2,13.3);
					TelePos[playerid][0] = 0.0;TelePos[playerid][1] = 0.0;
				}
				else
				{
					DOO_SetPlayerPos(playerid, 1529.6,-1691.2,13.3);
				}
				SendClientMessage(playerid, COLOR_GRAD1, "   You have been teleported !");
				SetPlayerInterior(playerid,0);
				PlayerInfo[playerid][pInt] = 0;
			}
			else
			{
				SendClientMessage(playerid, COLOR_GRAD1, "   You are not authorized to use that command !");
			}
		}
		return 1;
	}
EDIT:

I have tryd something in desperateness:

Код:
if(strcmp(cmd, "/sppos", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /sppos [pos.]");
				return 1;
			}
			new pos;
			pos = SetPlayerPos(tmp);
			if(!strlen(tmp))
			{
			if (PlayerInfo[playerid][pJob] == 30)
			{
				SetPlayerPos(playerid, pos)
					}
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_GRAD1, "   you are not in the Special Person Group!");
			}
		}
		return 1;
	}
Maby anyone can make that work
Reply
#2

zcmd + sscanf

Like this?
pawn Код:
COMMAND:gotopos(playerid, params[])
{
    new Float:PosX, Float:PosY, Float:PosZ;
    if(sscanf(params, "fff", PosX, PosY, PosZ)) return SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /gotopos x, y, z");
    else if(PlayerInfo[playerid][pAdmin] == 0) return SendClientMessage(playerid, COLOR_GRAD1, "   You are not authorized to use that command !");
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            DOO_SetVehiclePos(GetPlayerVehicleID(playerid), PosX, PosY, PosZ);
        }
        else
        {
            DOO_SetPlayerPos(playerid, PosX, PosY, PosZ);
        }
        SendClientMessage(playerid, COLOR_GRAD1, "   You have been teleported !");
        SetPlayerInterior(playerid,0);
        PlayerInfo[playerid][pInt] = 0;
    }
    return 1;
}
pawn Код:
COMMAND:gotols(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] == 0) return SendClientMessage(playerid, COLOR_GRAD1, "   You are not authorized to use that command !");
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            DOO_SetVehiclePos(GetPlayerVehicleID(playerid), 1529.6,-1691.2,13.3);
        }
        else
        {
            DOO_SetPlayerPos(playerid, 1529.6,-1691.2,13.3);
        }
    }
    return 1;
}
Reply
#3

I dont have COMMAND: gotopos and stuff so i guess that should be this:

Код:
	if (strcmp(cmd, "/gotopos", true) == 0)
	{
    new Float:PosX, Float:PosY, Float:PosZ;
    if(sscanf(params, "fff", PosX, PosY, PosZ)) return SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /gotopos x, y, z");
    else if(PlayerInfo[playerid][pAdmin] == 0) return SendClientMessage(playerid, COLOR_GRAD1, "   You are not authorized to use that command !");
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            DOO_SetVehiclePos(GetPlayerVehicleID(playerid), PosX, PosY, PosZ);
        }
        else
        {
            DOO_SetPlayerPos(playerid, PosX, PosY, PosZ);
        }
        SendClientMessage(playerid, COLOR_GRAD1, "   You have been teleported !");
        SetPlayerInterior(playerid,0);
        PlayerInfo[playerid][pInt] = 0;
    }
    return 1;
}
But it gives an error, Saying that sscanf = Nothing


I dont know how this works, But you need o exchange the COMMAND: stuff to:

Код:
if(strcmp(cmd, "/gotopos", true) == 0)
Reply
#4

Quote:
Originally Posted by up2u
Посмотреть сообщение
I dont have COMMAND: gotopos and stuff so i guess that should be this:

Код:
	if (strcmp(cmd, "/gotopos", true) == 0)
	{
    new Float:PosX, Float:PosY, Float:PosZ;
    if(sscanf(params, "fff", PosX, PosY, PosZ)) return SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /gotopos x, y, z");
    else if(PlayerInfo[playerid][pAdmin] == 0) return SendClientMessage(playerid, COLOR_GRAD1, "   You are not authorized to use that command !");
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            DOO_SetVehiclePos(GetPlayerVehicleID(playerid), PosX, PosY, PosZ);
        }
        else
        {
            DOO_SetPlayerPos(playerid, PosX, PosY, PosZ);
        }
        SendClientMessage(playerid, COLOR_GRAD1, "   You have been teleported !");
        SetPlayerInterior(playerid,0);
        PlayerInfo[playerid][pInt] = 0;
    }
    return 1;
}
But it gives an error, Saying that sscanf = Nothing
Код:
	
if (strcmp(cmd, "/setpos", true) == 0)
{
    new Float:X, Float:Y, Float:Z;
    GetPlayerPos(playerid, X, Y, Z);
    SetPVarFloat(playerid, "SavedX", X);
    SetPVarFloat(playerid, "SavedY", Y);
    SetPVarFloat(playerid, "SavedZ", Z);
    SendClientMessage(playerid,COLOR_GREEN, "Position saved.");
    return 1;
}
if (strcmp(cmd, "/gotopos", true) == 0)
{
    new Float:X, Float:Y, Float:Z;
    X = GetPVarFloat(playerid, "SavedX");
    Y = GetPVarFloat(playerid, "SavedY");
    Z = GetPVarFloat(playerid, "SavedZ");
    SetPlayerPos(playerid, X, Y, Z);
    SendClientMessage(playerid,COLOR_GREEN, "You went to saved position.");
    return 1;
}
Reply
#5

Quote:
Originally Posted by [GF]Sasino97
Посмотреть сообщение
Код:
	
if (strcmp(cmd, "/setpos", true) == 0)
{
    new Float:X, Float:Y, Float:Z;
    GetPlayerPos(playerid, X, Y, Z);
    SetPVarFloat(playerid, "SavedX", X);
    SetPVarFloat(playerid, "SavedY", Y);
    SetPVarFloat(playerid, "SavedZ", Z);
    SendClientMessage(playerid,COLOR_GREEN, "Position saved.");
    return 1;
}
if (strcmp(cmd, "/gotopos", true) == 0)
{
    new Float:X, Float:Y, Float:Z;
    X = GetPVarFloat(playerid, "SavedX");
    Y = GetPVarFloat(playerid, "SavedY");
    Z = GetPVarFloat(playerid, "SavedZ");
    SetPlayerPos(playerid, X, Y, Z);
    SendClientMessage(playerid,COLOR_GREEN, "You went to saved position.");
    return 1;
}
DUDE, Again you helped me!! Man!!

Join my Teamviewer dude xD:

689 387 818
8517
Reply
#6

Quote:
Originally Posted by [GF]Sasino97
Посмотреть сообщение
Код:
	
if (strcmp(cmd, "/setpos", true) == 0)
{
    new Float:X, Float:Y, Float:Z;
    GetPlayerPos(playerid, X, Y, Z);
    SetPVarFloat(playerid, "SavedX", X);
    SetPVarFloat(playerid, "SavedY", Y);
    SetPVarFloat(playerid, "SavedZ", Z);
    SendClientMessage(playerid,COLOR_GREEN, "Position saved.");
    return 1;
}
if (strcmp(cmd, "/gotopos", true) == 0)
{
    new Float:X, Float:Y, Float:Z;
    X = GetPVarFloat(playerid, "SavedX");
    Y = GetPVarFloat(playerid, "SavedY");
    Z = GetPVarFloat(playerid, "SavedZ");
    SetPlayerPos(playerid, X, Y, Z);
    SendClientMessage(playerid,COLOR_GREEN, "You went to saved position.");
    return 1;
}
oh, it was that he meant
Reply
#7

Quote:
Originally Posted by CyberGhost
Посмотреть сообщение
oh, it was that he meant
nononono Wait i just noticed when i went IG this is not what i wanted XD
thats the same as: /mark /gotomark

I wanted /gotopos [the Poss.]
Reply
#8

Quote:
Originally Posted by up2u
Посмотреть сообщение
DUDE, Again you helped me!! Man!!

Join my Teamviewer dude xD:

689 387 818
8517
This evening I'll come again to help you with the SP commands


EDIT.......... DIDN'T SEE...

Quote:
Originally Posted by up2u
Посмотреть сообщение
nononono Wait i just noticed when i went IG this is not what i wanted XD
thats the same as: /mark /gotomark

I wanted /gotopos [the Poss.]
Код:
	
if (strcmp(cmd, "/gotopos", true) == 0)
{
    new Xtmp[24];
    new Ytmp[24];
    new Ztmp[24];
    new Float:X, Float:Y, Float:Z;
    if(!strlen(Xtmp) || !strlen(Ytmp) || !strlen(Ztmp)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /gotopos [X] [Y] [Z]);
    X = floatstr(Xtmp);
    Y = floatstr(Ytmp);
    Z = floatstr(Ztmp);
    SetPlayerPos(playerid, X, Y, Z);
    return 1;
}
Reply
#9

Come now :P
I need help

689 387 818
8517
Reply
#10

Quote:
Originally Posted by up2u
Посмотреть сообщение
Come now :P
I need help

689 387 818
8517
I'm not at home now... I can't help from this PC
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)