SA-MP Forums Archive
Commands error ! - 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: Commands error ! (/showthread.php?tid=542317)



Commands error ! - Crazydriver - 18.10.2014

Hey guys so when i do cmds like /goto, /setlevel, /givecash which require id's it says the error me$sage in my case player not online even if the player is online can somebody help ? Using a mysql script


Re: Commands error ! - dominik523 - 18.10.2014

Nobody will help you without the code.


Re: Commands error ! - Greaper - 18.10.2014

Code?


Re: Commands error ! - Crazydriver - 18.10.2014

This is the code if i remove the error line it teleports me to blueberry !!
PHP код:
dcmd_goto(playeridparams[])
{
    if(
UserStats[playerid][Admin] >= 2)
    {
        new 
id;
                if(!
IsPlayerConnected(id)) return SendClientMessage(playeridCOLOR_REDRTNUSRNoResults); // ID is not connected, send an error message ====>Error Line
        
if(sscanf(params"u"id)) return SendClientMessage(playeridCOLOR_RED"Admin Usage: /Goto (id/name)");
          else
        {
            new 
string[128];
            new 
FloatxFloatyFloatz,Float:a;
            
GetPlayerPos(id,x,y,z);
            
GetPlayerFacingAngle(ida);
            new 
interior GetPlayerInterior(id);
            
            new 
name[24];
            
GetPlayerName(idname24);
            if(
IsPlayerNPC(id))
            {
                 if(!
strcmp(name,"[BOT]Pendelbury",true)) { interior 3; }
                 if(!
strcmp(name,"[BOT]Felix",true)) { interior 3; }
            }
            new 
vworld GetPlayerVirtualWorld(id);
            
SetPlayerPos(playeridx+2,y,z);
            
SetPlayerFacingAngle(playerida);
            
SetCameraBehindPlayer(playerid);
            
SetPlayerInterior(playerid,interior);
            
SetPlayerVirtualWorld(playerid,vworld);
            
UserStats[playerid][InHouseID] = UserStats[id][InHouseID];
            
format(stringsizeof(string), "*{F6A4D5}ADMIN INFO: {FFFFFF}You Teleported To {F6A4D5}%s(%d)"UserStats[id][Name], id);
            
SendClientMessage(playeridCOLOR_WHITEstring);
        }
    }
    else return 
SendClientMessage(playeridCOLOR_RED"Looks like you forgot the commands! Use /commands for a list of commands.");
    return 
1;




Re: Commands error ! - dominik523 - 18.10.2014

First of all, you need to get ID from params using sscanf. You can't check is the player connected before sscanf because ID will always be 0 in that case.
pawn Код:
dcmd_goto(playerid, params[])
{
    if(UserStats[playerid][Admin] >= 2)
    {
        if(sscanf(params, "u", id)) return SendClientMessage(playerid, COLOR_RED, "Admin Usage: /Goto (id/name)");

        new id;
        if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_RED, RTNUSRNoResults);
        new string[128];
        new Float: x, Float: y, Float: z,Float:a;
        GetPlayerPos(id,x,y,z);
        GetPlayerFacingAngle(id, a);
        new interior = GetPlayerInterior(id);
        new name[24];
        GetPlayerName(id, name, 24);
        if(IsPlayerNPC(id))
        {
            if(!strcmp(name,"[BOT]Pendelbury",true)) { interior = 3; }
            if(!strcmp(name,"[BOT]Felix",true)) { interior = 3; }
        }
        new vworld = GetPlayerVirtualWorld(id);
        SetPlayerPos(playerid, x+2,y,z);
        SetPlayerFacingAngle(playerid, a);
        SetCameraBehindPlayer(playerid);
        SetPlayerInterior(playerid,interior);
        SetPlayerVirtualWorld(playerid,vworld);
        UserStats[playerid][InHouseID] = UserStats[id][InHouseID];
        format(string, sizeof(string), "*{F6A4D5}ADMIN INFO: {FFFFFF}You Teleported To {F6A4D5}%s(%d)", UserStats[id][Name], id);
        SendClientMessage(playerid, COLOR_WHITE, string);
    }
    else return SendClientMessage(playerid, COLOR_RED, "Looks like you forgot the commands! Use /commands for a list of commands.");
    return 1;
}



Re: Commands error ! - 0x41726d79 - 18.10.2014

You need first to get data from params and after you can check if he is online.


Re: Commands error ! - Crazydriver - 18.10.2014

So i need a fix i am not a pro scripter !! anything you or anyone can do?


Re: Commands error ! - dominik523 - 18.10.2014

Can you please read next time, I put it in my previous post.
Код:
dcmd_goto(playerid, params[])
{
    if(UserStats[playerid][Admin] >= 2)
    {
        new id;
        if(sscanf(params, "u", id)) return SendClientMessage(playerid, COLOR_RED, "Admin Usage: /Goto (id/name)");
        if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_RED, RTNUSRNoResults);



Re: Commands error ! - Crazydriver - 18.10.2014

Quote:

Can you please read next time, I put it in my previous post.

THx for helping but it didn't work ........


Re: Commands error ! - Crazydriver - 18.10.2014

Bump