SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 31/07/2011, 04:42 AM   #1
HydraX
Gangsta
 
Join Date: Mar 2009
Location: Don`t stalk me..
Posts: 963
Reputation: 18
Default Login Issue

It works! Thanks, now I got another issue!

pawn Code:
case DIALOG_LOGIN: //for loging
        {
            if(response)
            { //opening barrel
                new
                    strText[179], naslov2[128];
               
                if(strlen(inputtext) >= 4 && strlen(inputtext) <= 35)
                { //opening barrel
                    OnPlayerLogin(playerid, inputtext); //loading stats
                } //closing barrel
                else
                { //opening barrel
                    format(naslov2, sizeof(naslov2), ""COL_GREEN2"     Welcome"COL_WHITE" %s!", GetName(playerid)); //formating our title
                    format(strText, 179, ""COL_WHITE"______________________________\n\n"COL_GREEN2"Name"COL_WHITE" %s"COL_GREEN2" is registered!\n\n{F81414}You typed wrong password!", GetName(playerid)); //formating our text
                    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, naslov2, strText, "Login", "Exit");
                }
            }
            else Kick(playerid);
        }
    }
The Login code doesn't seem correct. I can type anything and still login.
__________________
kthxbai.
http://pastebin.com/cLxes1HM

West Coast Generation - Alpha [0.3e]
108.213.37.171:7777

Last edited by HydraX; 31/07/2011 at 08:10 PM.
HydraX is offline  
Old 31/07/2011, 04:51 AM   #2
[HiC]TheKiller
High-roller
 
Join Date: Mar 2008
Location: New Zealand
Posts: 3,076
Reputation: 406
Default Re: Slap command returns an Unknown Command when player is not connected

pawn Code:
sscanf(params, "is[128]", playerid)

That has one single param, playerid. Your code should look more like

pawn Code:
sscanf(params, "i", playerid)

Also, for single params, you can just do this:

pawn Code:
playerid = strval(params);
__________________
People seem to enjoy negitive repping me for topics that I made in 2009.
Therefore, if you want to view my releases, you can go here.

Skype: TheKiller@dr.com
I do NOT script for cash. Add me on MSN if you need help with small issues.
[HiC]TheKiller is offline  
Old 31/07/2011, 04:55 AM   #3
HydraX
Gangsta
 
Join Date: Mar 2009
Location: Don`t stalk me..
Posts: 963
Reputation: 18
Default Re: Slap command returns an Unknown Command when player is not connected

Doesn't that return a "Strings without a length are deprecated" warning ?
__________________
kthxbai.
http://pastebin.com/cLxes1HM

West Coast Generation - Alpha [0.3e]
108.213.37.171:7777
HydraX is offline  
Old 31/07/2011, 05:00 AM   #4
HydraX
Gangsta
 
Join Date: Mar 2009
Location: Don`t stalk me..
Posts: 963
Reputation: 18
Default Re: Slap command returns an Unknown Command when player is not connected

BTW, When you type /slap 1, I get an Unknown Command, and not "Player not Connected".
Note That only ID 0 is connected.
__________________
kthxbai.
http://pastebin.com/cLxes1HM

West Coast Generation - Alpha [0.3e]
108.213.37.171:7777
HydraX is offline  
Old 31/07/2011, 05:01 AM   #5
Runedog48
Big Clucker
 
Join Date: Jul 2011
Posts: 81
Reputation: 0
Default Re: Slap command returns an Unknown Command when player is not connected

Add a return 1; to the end of it and make the else statement...
pawn Code:
if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdmin] >= 1)
    {
        if(sscanf(params, "is[128]", playerid)) return SendClientMessage(playerid, COLOR_ORANGE, "Usage: /slap [playerid]"); // Checking is the player just typed /slap now e.g. /slap 0 10
        if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, COLOR_ORANGE, "Player not connected");
        //else
        format(string, sizeof(string), "%s has slapped %s",pName,vName); // Defining string
        SendClientMessageToAll(COLOR_ORANGE, string);
        GetPlayerPos(playerid, x,y,z);
        SetPlayerPos(playerid,x,y,z+15);
//here return 1;
    }
__________________

Runedog48 is offline  
Old 31/07/2011, 05:04 AM   #6
HydraX
Gangsta
 
Join Date: Mar 2009
Location: Don`t stalk me..
Posts: 963
Reputation: 18
Default Re: Slap command returns an Unknown Command when player is not connected

Wait what? Where am I suppose to put it?
__________________
kthxbai.
http://pastebin.com/cLxes1HM

West Coast Generation - Alpha [0.3e]
108.213.37.171:7777
HydraX is offline  
Old 31/07/2011, 05:11 AM   #7
HydraX
Gangsta
 
Join Date: Mar 2009
Location: Don`t stalk me..
Posts: 963
Reputation: 18
Default Re: Slap command returns an Unknown Command when player is not connected

So Like this?
pawn Code:
if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdmin] >= 1)
    {
        if(sscanf(params, "i", playerid)) return SendClientMessage(playerid, COLOR_ORANGE, "Usage: /slap [playerid]"); // Checking is the player just typed /slap now e.g. /slap 0 10
        if(IsPlayerConnected(playerid))
        {
            format(string, sizeof(string), "%s has slapped %s",pName,vName); // Defining string
            SendClientMessageToAll(COLOR_ORANGE, string);
            GetPlayerPos(playerid, x,y,z);
            SetPlayerPos(playerid,x,y,z+15);
            return 1;
        }
        else
        {
            SendClientMessage(playerid, COLOR_ORANGE,"Player is not connected");
        }
    }
Now it won't show the "Player is not Connected" message.
__________________
kthxbai.
http://pastebin.com/cLxes1HM

West Coast Generation - Alpha [0.3e]
108.213.37.171:7777
HydraX is offline  
Old 31/07/2011, 05:34 AM   #8
Jack_Leslie
Gangsta
 
Jack_Leslie's Avatar
 
Join Date: Feb 2011
Location: Australia
Posts: 836
Reputation: 60
Default Re: Slap command returns an Unknown Command when player is not connected

pawn Code:
if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdmin] >= 1)
    {
        if(sscanf(params, "i", playerid)) return SendClientMessage(playerid, COLOR_ORANGE, "Usage: /slap [playerid]"); // Checking is the player just typed /slap now e.g. /slap 0 10
        if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, COLOR_ORANGE, "Player is not connected");
            format(string, sizeof(string), "%s has slapped %s",pName,vName); // Defining string
            SendClientMessageToAll(COLOR_ORANGE, string);
            GetPlayerPos(playerid, x,y,z);
            SetPlayerPos(playerid,x,y,z+15);
            return 1;
    }

But I think you need to make a "giveplayerid" and make it so "giveplayerid" is the playerid that gets slapped? Otherwise the script is going to confuse it's self..
__________________
Working on a roleplay project, contact me if you want to be involved!
Jack_Leslie is offline  
Old 31/07/2011, 05:25 PM   #9
HydraX
Gangsta
 
Join Date: Mar 2009
Location: Don`t stalk me..
Posts: 963
Reputation: 18
Default Re: Slap command returns an Unknown Command when player is not connected

I don't get what you are saying.
I still need help! Now it doesn't return a Message when it should send "Player not connected"
__________________
kthxbai.
http://pastebin.com/cLxes1HM

West Coast Generation - Alpha [0.3e]
108.213.37.171:7777
HydraX is offline  
Old 31/07/2011, 05:49 PM   #10
Toreno
Gangsta
 
Join Date: Nov 2010
Posts: 846
Reputation: 41
Default Re: Slap command returns an Unknown Command when player is not connected

Try this, looks perfect to me. HOWEVER, not tested.
Also, "i" parameter is an integer and "u" parameter represents User (bot/player) ...
BTW, do not update your SA-MP server to R5 until Y_Less fixes the "u" parameter, meanwhile, stay with R4 or lower.
pawn Code:
YCMD:slap(playerid, params[], help) {
    #pragma unused help
    new targetid, Float:x, Float:y, Float:z, slap_string[62];
    if(!IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_ORANGE,"You are not a high enough level to use this command !");
    if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_ORANGE, "Usage: /slap [playerid]"); // "u" parameter is User (bot/player)
    if(targetid == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_ORANGE, "Player not connected");
    format(slap_string, sizeof(slap_string), "%s has slapped %s", GetPlayerNameEx(playerid), GetPlayerNameEx(targetid));
    SendClientMessageToAll(COLOR_ORANGE, string);
    GetPlayerPos(targetid, x, y, z);
    SetPlayerPos(targetid, x, y, z+15);
    return 1;
}

stock GetPlayerNameEx(playerid) {
    new PlayerName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
    return PlayerName;
}
Toreno is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Command returns SERVER: Unknown command admantis Help Archive 7 09/12/2010 07:52 AM
Command that returns SERVER: Unknown Command. pagie1111 Help Archive 11 11/04/2010 09:55 AM
Commands working, but returns Server: Unknown Command WickWoody Help Archive 1 09/09/2009 12:13 AM
Onconsoletext always returns unknown command ... ғαιιοцт Help Archive 7 09/07/2009 05:05 PM
Returns as Unknown Command JoeDaDude Help Archive 4 09/02/2009 05:00 PM


All times are GMT. The time now is 03:14 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.