/freeze closes server?
#1

My /freeze command works, but it closes the server? but other cmds work fine..

Код:
CMD:freeze(playerid, params[])
{
	new string[128], targetid, tname[MAX_PLAYER_NAME+1], pname[MAX_PLAYER_NAME+1];
	if(pInfo[playerid][Admin] == 0) return SendClientMessage(playerid, 0x46E850FF, "SERVER:{FFFFFF} You're not an administrator!");
	
	GetPlayerName(playerid, pname, sizeof(pname)), GetPlayerName(targetid, tname, sizeof(tname));
	
	TogglePlayerControllable(targetid, 0);
	
	format(string, sizeof(string), " You have frozen %s.", pname);
	SendClientMessage(playerid, COLOR_GREY, string);
	
	format(string, sizeof(string), " Administrator %s has freezed you.", tname);
	SendClientMessage(targetid, COLOR_GREY, string);
	
	return 1;
}
Reply
#2

Use sscanf.

PHP код:
CMD:freeze(playerid, params[])
{
    new 
string[128], targetid, tname[MAX_PLAYER_NAME+1], pname[MAX_PLAYER_NAME+1];
    if(
pInfo[playerid][Admin] == 0) return SendClientMessage(playerid, 0x46E850FF, "SERVER:{FFFFFF} You're not an administrator!");
    if(
sscanf(params, "u", targetid)) return SendClientMessage(playerid, -1, "ERROR: Correct usage: /freeze [id/name]");
    
GetPlayerName(playerid, pname, sizeof(pname)), GetPlayerName(targetid, tname, sizeof(tname));
    
    
TogglePlayerControllable(targetid, 0);
    
    
format(string, sizeof(string), " You have frozen %s.", pname);
    
SendClientMessage(playerid, COLOR_GREY, string);
    
    
format(string, sizeof(string), " Administrator %s has freezed you.", tname);
    
SendClientMessage(targetid, COLOR_GREY, string);
    
    return 
1;
} 
If it didn't fix, use crashdetect.dll and post the log made by it.
Reply
#3

+rep for you sir.
Reply
#4

PHP код:
CMD:freeze(playerid, params[])
{
    new 
string[128], targetid, tname[MAX_PLAYER_NAME+1], pname[MAX_PLAYER_NAME+1];
    if(
pInfo[playerid][Admin] == 0) return SendClientMessage(playerid, 0x46E850FF, "SERVER:{FFFFFF} You're not an administrator!");
    {
        if(
sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /freeze [id] ");//tell sscanf again if the parameters/syntax is wrong to return a special message
        
GetPlayerName(playerid, pname, sizeof(pname)), GetPlayerName(targetid, tname, sizeof(tname));    
        
TogglePlayerControllable(targetid, 0);    
        
format(string, sizeof(string), " You have frozen %s.", pname);
        
SendClientMessage(playerid, COLOR_GREY, string);    
        
format(string, sizeof(string), " Administrator %s has freezed you.", tname);
        
SendClientMessage(targetid, COLOR_GREY, string);
    }
    return 
1;
} 
Reply
#5

Quote:
Originally Posted by arlindi
Посмотреть сообщение
PHP код:
CMD:freeze(playerid, params[])
{
    new 
string[128], targetid, tname[MAX_PLAYER_NAME+1], pname[MAX_PLAYER_NAME+1];
    if(
pInfo[playerid][Admin] == 0) return SendClientMessage(playerid, 0x46E850FF, "SERVER:{FFFFFF} You're not an administrator!");
    {
        if(
sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /freeze [id] ");//tell sscanf again if the parameters/syntax is wrong to return a special message
        
GetPlayerName(playerid, pname, sizeof(pname)), GetPlayerName(targetid, tname, sizeof(tname));    
        
TogglePlayerControllable(targetid, 0);    
        
format(string, sizeof(string), " You have frozen %s.", pname);
        
SendClientMessage(playerid, COLOR_GREY, string);    
        
format(string, sizeof(string), " Administrator %s has freezed you.", tname);
        
SendClientMessage(targetid, COLOR_GREY, string);
    }
    return 
1;
} 
was it just the indentation?
Reply
#6

nOO LOOOK THE uSAGE
Reply
#7

Quote:
Originally Posted by arlindi
Посмотреть сообщение
nOO LOOOK THE uSAGE
The whole command is the same, just indented and rearranged 2 lines.
Reply
#8

Ok
I didnt saw the post
I was creating it for you when he post ok
Reply
#9

Quote:
Originally Posted by arlindi
Посмотреть сообщение
nOO LOOOK THE uSAGE
if so.. why does this not work?

Код:
CMD:thaw(playerid, params[])
{
    new string[128], targetid, tname[MAX_PLAYER_NAME+1], pname[MAX_PLAYER_NAME+1];
    if(pInfo[playerid][Admin] == 0) return SendClientMessage(playerid, 0x46E850FF, "SERVER:{FFFFFF} You're not an administrator!");
    {
	    if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, -1, "ERROR: Correct usage: /thaw [id/name]");
	    GetPlayerName(playerid, pname, sizeof(pname)), GetPlayerName(targetid, tname, sizeof(tname));
		TogglePlayerControllable(targetid, 1);
		format(string, sizeof(string), " You have thawed %s.", pname);
		SendClientMessage(playerid, COLOR_GREY, string);
		format(string, sizeof(string), " %s was thawed by %s.", pname, tname);
		SendClientMessage(targetid, COLOR_GREY, " %s was thawed by %s.");
	}
	return 1;
}
Reply
#10

And if this not work
I do what i know
OKk
Reply


Forum Jump:


Users browsing this thread: