SA-MP Forums Archive
Offline ban[+REP] - 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: Offline ban[+REP] (/showthread.php?tid=626848)



Offline ban[+REP] - [SU]Spartan - 21.01.2017

Код:
CMD:oban(playerid,params[])
{
				new id, string[500];
				if(sscanf(params,"u",id)) return SendClientMessage(playerid,COLOR_RED,"USAGE:{FFFFFF}/oban [ACCOUNT NAME]");
				if(dini_Exists(Account(id)))
	    	    {
	    	    banned[id] = 1;
       			dini_IntSet(Account(id),"banned",banned[id]);
				format(string,sizeof(string),""COL_LIME"Account %s has been banned",id);
				SendClientMessageToAll(COLOR_YELLOW,string);
				return 1;
	    	    }
	    	    else
	    	    {
	        	    SendClientMessage(playerid, -1, "That player does not exist!");
	    	    }
	    	    return 1;
}
So, when i go ingame and I do /oban, if the player is offline it doesnt ban him, player must be online, but i want it for offline ban.


Re: Offline ban[+REP] - BiosMarcel - 21.01.2017

use specifier "i" or "d" instead of "u", because "u" is for playernames/ids of players that are online

Edit:

I am assuming that your "Account(id)" function works properly.


Re: Offline ban[+REP] - [SU]Spartan - 21.01.2017

I go try now, will reply.


Re: Offline ban[+REP] - oMa37 - 21.01.2017

It's offline ban, Which means the player is not online. How can you ban him with his ID? lol
You should ban with his name, not ID.


Re: Offline ban[+REP] - BiosMarcel - 21.01.2017

Quote:
Originally Posted by oMa37
Посмотреть сообщение
It's offline ban, Which means the player is not online. How can you ban him with his ID? lol
You should ban with his name, not ID.
His Account function is probably retrieving the players file through a unique id, at least thats what i thought, which is probably totally wrong
Otherwise,i couldn't think of a reason why he even called his parameter "id"


Re: Offline ban[+REP] - [SU]Spartan - 21.01.2017

dude really? it's just new id; it doesnt specify the id of a player, you could enter anything.


Re: Offline ban[+REP] - BiosMarcel - 21.01.2017

u didn't even get what i mean

i was talking about your naming, you called it id , so i thought you have some kind of unique id in your player files.


Re: Offline ban[+REP] - Dutheil - 21.01.2017

You want do this ? :
PHP код:
CMD:oban(playeridparams[])
{
    if(
isnull(params)) return SendClientMessage(playeridCOLOR_RED"USAGE:{FFFFFF}/oban [ACCOUNT NAME]");
    
    new
        
account[40] = "Accounts/";
    
strcat(accountstrcat);
    
strins(account".ini");
    
    if(!
dini_Exists(account)) return SendClientMessage(playerid, -1"That player does not exist!");
    
dini_IntSet(account"banned"1);
    
    new
        
string[64];
    
    
format(stringsizeof(string), ""COL_LIME"Account %s has been banned"params);
    
SendClientMessageToAll(COLOR_YELLOW,string);
    
    return 
1;




Re: Offline ban[+REP] - [SU]Spartan - 21.01.2017

here comes this
Код:
CMD:ofban(playerid, params[])
{
    if(isnull(params)) return SendClientMessage(playerid, COLOR_RED, "USAGE:{FFFFFF}/oban [ACCOUNT NAME]");

    new
        account[40] = "users/";

    strcat(account, strcat);
    strins(account, ".ini");

    if(!dini_Exists(account)) return SendClientMessage(playerid, -1, "That player does not exist!");

    dini_IntSet(account, "banned", 1);

    new
        string[64];

    format(string, sizeof(string), ""COL_LIME"Account %s has been banned", params);
    SendClientMessageToAll(COLOR_YELLOW,string);

    return 1;
}
Код:
C:\Users\John\Desktop\projects 2016\ESDS 0.3.7 NEW\gamemodes\ESDS.pwn(4650) : error 076: syntax error in the expression, or invalid function call



Re: Offline ban[+REP] - Yaa - 21.01.2017

PHP код:
CMD:ofban(playeridparams[])
{
    if(
isnull(params)) return SendClientMessage(playeridCOLOR_RED"USAGE:{FFFFFF}/oban [ACCOUNT NAME]");
    new
        
account[40] = "users/";
    
strcat(accountparams);
    
strins(account".ini");
    if(!
dini_Exists(account)) return SendClientMessage(playerid, -1"That player does not exist!");
    
dini_IntSet(account"banned"1);
    new
        
string[64];
    
format(stringsizeof(string), ""COL_LIME"Account %s has been banned"params);
    
SendClientMessageToAll(COLOR_YELLOW,string);
    return 
1;