#1

lol...

today I created a new Admin's House. I tried to find it in MTA, and I converted it here. Now, the problem is that, after I created this house I created a teleport command that teleports you to the house. Here it is (The full command/createobject):

pawn Код:
public OnGameModeInit()
{
    // Don't use these lines if it's a filterscript
    SetGameModeText("UK-RP v0.1");
    AddPlayerClass(299,1614.7527,-1498.3807,14.2381,90.9994,0,0,0,0,0,0); // newb spawn
    // Special houses
    CreateObject(3483, -2329.9060058594, -1619.1413574219, 489.66583251953, 1, 0, 0); // admin house
    return 1;
}
^^ This is my house

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    dcmd(pay, 3, cmdtext);
    dcmd(sethealth, 9, cmdtext);
// admin cmds---------------------------
    dcmd(sendtopd, 8, cmdtext);
    dcmd(sendtogym, 9, cmdtext);
    dcmd(sendtoadmh, 10, cmdtext); // the dcmd define for my tp cmd
// text--------------------------------
    dcmd(me, 2, cmdtext);
    dcmd(do, 2, cmdtext);
// player connect----------------------
    dcmd(register, 8, cmdtext);
    dcmd(login, 5, cmdtext);
    return 1;
}

dcmd_sendtoadmh(playerid, params[])
{
    new targetid, pName[MAX_PLAYER_NAME];
    if(sscanf(params, "i", targetid)) return SendClientMessage, COLOR_RED, "/sendtoadmh [playerid]");
    else if(IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "You have no access to this command");
    else if(targetid == INVALID_PLAYER_ID || IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_RED, "Player Not Found");
    else
    {
        GetPlayerName(targetid, pName, MAX_PLAYER_NAME);
        SetPlayerPos(targetid, -2329.9060058594, -1619.1413574219, 489.66583251953);
        format(string, 128, "You transfered %s (ID: %i) to Admin's House", pName, targetid);
        format(msg, 128, "You got transfered to Admin's House by Admin %s", playerid);
        SendClientMessage(playerid, COLOR_LIGHTBULE, string);
        SendClientMessage(targetid, COLOR_LIGHTBLUE, msg);
    }
    return 1;
}
Now, this is the cmd. AFTER I typed all this, when I tried to compile it happens:





OMGWTF?!?!?!

Any solutions or w/e ?
Reply
#2

put the dcmd_sendtoadmh(playerid, params[]) above the callback

i get this error always when i put something in the wrong place

EDIT: o wait..maybe it should work..hmmm... idunno just check line by line here must be a stupid mistake there
Reply
#3

At first playerid is not a string. Check your second format and change %s to %i.

Edit: Try this:

pawn Код:
dcmd_sendtoadmh(playerid, params[])
{
    new targetid, pName[MAX_PLAYER_NAME],Playername[MAX_PLAYER_NAME];
    if(sscanf(params, "i", targetid)) return SendClientMessage, COLOR_RED, "/sendtoadmh [playerid]");
    {
        if(IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "You have no access to this command");
        {
            if(targetid == INVALID_PLAYER_ID || IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_RED, "Player Not Found");
            {
                GetPlayerName(targetid, pName, MAX_PLAYER_NAME);
                GetPlayerName(playerid, Playername, MAX_PLAYER_NAME);
                SetPlayerPos(targetid, -2329.9060058594, -1619.1413574219, 489.66583251953);
                format(string, 128, "You transfered %s (ID: %i) to Admin's House", pName, targetid);
                format(msg, 128, "You got transfered to Admin's House by Admin %s", Playername, playerid);
                SendClientMessage(playerid, COLOR_LIGHTBULE, string);
                SendClientMessage(targetid, COLOR_LIGHTBLUE, msg);
                return 1;
            }
        }
    }
}
Reply
#4

nopes... it isn't working again!
Reply
#5

Probably your define for the color is wrong.

Btw, you are checking if the player is connected -> return invalid Player ID :P
Reply
#6

Quote:
Originally Posted by Jochemd
Посмотреть сообщение
Probably your define for the color is wrong.

Btw, you are checking if the player is connected -> return invalid Player ID :P
If a color is wrong, it wouldn't crash the compiler, just give a simple error.

Try this.
pawn Код:
dcmd_sendtoadmh(playerid, params[])
{
    new targetid, pName[MAX_PLAYER_NAME];
    if(sscanf(params, "i", targetid)) return SendClientMessage, COLOR_RED, "/sendtoadmh [playerid]");
    else if(IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "You have no access to this command");
    else if(targetid == INVALID_PLAYER_ID || IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_RED, "Player Not Found");
    GetPlayerName(targetid, pName, MAX_PLAYER_NAME);
    SetPlayerPos(targetid, -2329.9060058594, -1619.1413574219, 489.66583251953);
    format(string, 128, "You transfered %s (ID: %i) to Admin's House", pName, targetid);
    format(msg, 128, "You got transfered to Admin's House by Admin %s", playerid);
    SendClientMessage(playerid, COLOR_LIGHTBULE, string);
    SendClientMessage(targetid, COLOR_LIGHTBLUE, msg);
    return 1;
}
Reply
#7

Look, I have done other tp cmds EXACTLY like this, and np... wtf Is damn happening :@
Reply
#8

Try updating your compiler and includes
Reply
#9

disable all the dcmd stuff for a moment and try it with a simple command to see what happens.
Reply
#10

pawn Код:
dcmd_sendtoadmh(playerid, params[])
{
    new targetid, pName[MAX_PLAYER_NAME];
    if(sscanf(params, "u", targetid)) return SendClientMessage, COLOR_RED, "/sendtoadmh [playerid]");
    else if(IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "You have no access to this command");
    else if(targetid == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "Player Not Found");
    GetPlayerName(targetid, pName, MAX_PLAYER_NAME);
    SetPlayerPos(targetid, -2329.9060058594, -1619.1413574219, 489.66583251953);
    format(string, 128, "You transfered %s (ID: %d) to Admin's House", pName, targetid);
    format(msg, 128, "You got transfered to Admin's House by Admin ID %d", playerid);
    SendClientMessage(playerid, COLOR_LIGHTBULE, string);
    SendClientMessage(targetid, COLOR_LIGHTBLUE, msg);
    return 1;
}
I found little errors in sscanf...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)