SA-MP Forums Archive
OnPlayerCommandPerformed Bug - 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: OnPlayerCommandPerformed Bug (/showthread.php?tid=619774)



OnPlayerCommandPerformed Bug - dh240473 - 22.10.2016

I'm trying to make for who didn't login can't use any commands but it not working.. please help me.. when i use /rules commands it still pop up this is the script
pawn Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
    if(!success)
    {
        SendClientMessage(playerid,-1,""red"[SERVER]: "white"Unknown Command!");
        PlayerPlaySound(playerid,1149,0.0,0.0,0.0);
    }
    if(!IsPlayerLogged(playerid)) return SendClientMessage(playerid,-1,""red"[SERVER]: "white"You must login to use any commands!");
    return 1;
}
IsPlayerLogged code
pawn Код:
stock IsPlayerLogged(playerid)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
new file[256], tmp2;

format(file,256,"/ultrax/Users/%s.ini",name);
tmp2 = dini_Int(file,"Logged");

if((IsPlayerConnected(playerid)) && (tmp2 == 1) )
return true;
else return false;
}



Re: OnPlayerCommandPerformed Bug - DTV - 22.10.2016

Do you have the "Logged" stat set to 1 somewhere in the script?


Re: OnPlayerCommandPerformed Bug - dh240473 - 22.10.2016

Quote:
Originally Posted by DTV
Посмотреть сообщение
Do you have the "Logged" stat set to 1 somewhere in the script?
yes. i put in on my admin fs .. my include working fine because the client message is sent but the command still popping up..

sorry for my bad english


Re: OnPlayerCommandPerformed Bug - DTV - 22.10.2016

Show what part of the code that is and where it's being called.


Re: OnPlayerCommandPerformed Bug - dh240473 - 22.10.2016

Quote:
Originally Posted by DTV
Посмотреть сообщение
Show what part of the code that is and where it's being called.
PHP код:
function Login(playerid,inputtext[]){
    
dini_IntSet(userfile(playerid),"Logged"1);
    
AccInfo[playerid][Password] = dini_Int(userfile(playerid),"Password");
    
dini_Set(userfile(playerid), "IP"GetIP(playerid));
    
strcat(AccInfo[playerid][IP], dini_Get(userfile(playerid), "IP"));
    
AccInfo[playerid][Logged] = 1;
    
AccInfo[playerid][Regged] = 1;
    
AccInfo[playerid][Skin] = dini_Int(userfile(playerid),"Skin");
    
AccInfo[playerid][Money] = dini_Int(userfile(playerid),"Money");
    
AccInfo[playerid][Admin] = dini_Int(userfile(playerid),"Admin");
    
AccInfo[playerid][VIP] = dini_Int(userfile(playerid),"VIP");
    
AccInfo[playerid][DJ] = dini_Int(userfile(playerid),"DJ");
    
AccInfo[playerid][Death] = dini_Int(userfile(playerid),"Death");
    
AccInfo[playerid][Kill] = dini_Int(userfile(playerid),"Kill");
    
AccInfo[playerid][Jailed] = dini_Int(userfile(playerid),"Jailed");
    
AccInfo[playerid][Banned] = dini_Int(userfile(playerid),"Banned");
    
AccInfo[playerid][Stream] = dini_Int(userfile(playerid),"Stream");
    if(
AccInfo[playerid][Banned] == 1){ SendClientMessage(playerid,-1,""red"[SERVER]: "white"You're account has been banned."); return SetTimerEx("KickPlayer",3000,false,"i",playerid); }
    
SpawnPlayer(playerid);
    return 
1;




Re: OnPlayerCommandPerformed Bug - DTV - 22.10.2016

Код:
AccInfo[playerid][Logged] = 1;
I see this stat, assuming that it's tied to being logged in, you could try checking to see if this stat is equal to 1.


Re: OnPlayerCommandPerformed Bug - dh240473 - 22.10.2016

Quote:
Originally Posted by DTV
Посмотреть сообщение
Код:
AccInfo[playerid][Logged] = 1;
I see this stat, assuming that it's tied to being logged in, you could try checking to see if this stat is equal to 1.
it working .. i'm already check user file


Re: OnPlayerCommandPerformed Bug - DTV - 22.10.2016

Well, where do you have the Login function called at?


Re: OnPlayerCommandPerformed Bug - Sew_Sumi - 22.10.2016

Admin FS will not pass variables to the Gamemode... You need to read up on how that portion of scripting works.