Disable /go command inside a house
#4

pawn Код:
CMD:go(playerid, params[])
{
    new ID;//creates a new something idk what we call it :P but it is defined later on or used in something this 1 is used in next line
    if(sscanf(params, "u", ID)) return SendClientMessage(playerid, 0xFFFFFFFF, "{FFFF00}Usage: /go [PlayerID/PartofName]");//checks if you have written something after /goto if no it sends error
    if(!IsPlayerConnected(ID) || ID == playerid) return SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}This player is Offline or it is Yourself");
    if(GetPVarInt(playerid, "Jailed") == 1) return GameTextForPlayer(playerid,"Player is Jailed",2000,3);
    if(IsPlayerInDM[playerid] == 1) return SendClientMessage(playerid, 0xFFFFFFFF,"{FFFF00}(/go) {FF0000}command is disabled at this moment");
    if(IsInHouse{ID} == 1) return SendClientMessage(playerid, 0xFFFFFFFF,"ERROR: Stated Player is inside a house. Try again later.");
    new Float:x, Float:y, Float:z,str[64],tID;
    if(sscanf(params,"u",tID)) return 0;
    GetPlayerPos(tID, x, y, z);
    if(IsPlayerInAnyVehicle(playerid))
    {
        LinkVehicleToInterior(GetPlayerVehicleID(playerid), GetPlayerInterior(tID));
        SetVehicleVirtualWorld(GetPlayerVehicleID(playerid), GetPlayerVirtualWorld(tID));
        SetVehiclePos(GetPlayerVehicleID(playerid), x + 1, y + 1, z);
    }
    else
    {
        SetPlayerInterior(playerid, GetPlayerInterior(tID));
        SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(tID));
        SetPlayerPos(playerid, x + 1, y + 1, z + 0.5);
    }
    format(str, sizeof(str), "{FFFF00}(/go) %s (%d) has teleported to you", getname(playerid), playerid);
    SendClientMessage(tID, 0xFFFFFFFF, str);
    return 1;
}
This should work.
I wonder why you use sscanf twice.

Try this before trying the one above:
pawn Код:
CMD:go(playerid, params[])
{
    new ID;//creates a new something idk what we call it :P but it is defined later on or used in something this 1 is used in next line
    if(sscanf(params, "u", ID)) return SendClientMessage(playerid, 0xFFFFFFFF, "{FFFF00}Usage: /go [PlayerID/PartofName]");//checks if you have written something after /goto if no it sends error
    if(!IsPlayerConnected(ID) || ID == playerid) return SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}This player is Offline or it is Yourself");
    if(GetPVarInt(playerid, "Jailed") == 1) return GameTextForPlayer(playerid,"Player is Jailed",2000,3);
    if(IsPlayerInDM[playerid] == 1) return SendClientMessage(playerid, 0xFFFFFFFF,"{FFFF00}(/go) {FF0000}command is disabled at this moment");
    if(IsInHouse{tID} == 1) return SendClientMessage(playerid, 0xFFFFFFFF,"ERROR: Stated Player is inside a house. Try again later.");
    new Float:x, Float:y, Float:z,str[64],ID;
    GetPlayerPos(ID, x, y, z);
    if(IsPlayerInAnyVehicle(playerid))
    {
        LinkVehicleToInterior(GetPlayerVehicleID(playerid), GetPlayerInterior(ID));
        SetVehicleVirtualWorld(GetPlayerVehicleID(playerid), GetPlayerVirtualWorld(ID));
        SetVehiclePos(GetPlayerVehicleID(playerid), x + 1, y + 1, z);
    }
    else
    {
        SetPlayerInterior(playerid, GetPlayerInterior(ID));
        SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(ID));
        SetPlayerPos(playerid, x + 1, y + 1, z + 0.5);
    }
    format(str, sizeof(str), "{FFFF00}(/go) %s (%d) has teleported to you", getname(playerid), playerid);
    SendClientMessage(tID, 0xFFFFFFFF, str);
    return 1;
}
And 'new' creates a new variable.
Reply


Messages In This Thread
Disable /go command inside a house - by kbalor - 06.09.2012, 20:05
Re: Disable /go command inside a house - by Jeffry - 07.09.2012, 10:08
Re: Disable /go command inside a house - by kbalor - 07.09.2012, 13:09
Re: Disable /go command inside a house - by Jeffry - 07.09.2012, 18:13
Re: Disable /go command inside a house - by kbalor - 07.09.2012, 19:01
Re: Disable /go command inside a house - by MarkoN - 07.09.2012, 19:06
Re: Disable /go command inside a house - by kbalor - 07.09.2012, 19:13
Re: Disable /go command inside a house - by MarkoN - 07.09.2012, 19:24
Re: Disable /go command inside a house - by kbalor - 07.09.2012, 19:37
Re: Disable /go command inside a house - by MarkoN - 07.09.2012, 19:50

Forum Jump:


Users browsing this thread: 1 Guest(s)