Рекомендованные сообщения



4 posts in this topic

Проблема заключается в следующем. Начал делать команду, доделал и тут: 

CMD:setadmin(playerid, params[])
{
    if(antiflood[playerid] > 0) return SendClientMessage(playerid, COLOR_WARNING,"Не флуди!");
    antiflood[playerid]++;
    if(PLAYER_DATA[playerid][data_LOGGED] == false) return SendClientMessage(playerid,COLOR_WARNING,"Вы не авторизованы на сервере!");
    if(PLAYER_DATA[playerid][data_ADMLVL] < 7) return true;
   	if(sscanf(params,"ud[100]",params[0],params[1])) return SendClientMessage(playerid,COLOR_WARNING,"Используйте: /setadmin [ид] [уровень]");
    if(!IsPlayerConnected(params[0]))return  SendClientMessage(playerid,COLOR_WARNING,"Данного ID нет на сервере!");
	if(PLAYER_DATA[params[0]][data_LOGGED] == false)return  SendClientMessage(playerid,COLOR_WARNING,"Данный игрок не прошел авторизацию!");
    if(PLAYER_DATA[params[0]][data_ADMLVL] > PLAYER_DATA[playerid][data_ADMLVL]) return SendClientMessage(playerid, COLOR_WARNING, "Нельзя применить к старшей администрации!");
    mysql_format(dbHandle,query, sizeof(query),"UPDATE `accounts` SET `admlvl` = 'u' WHERE `name` = '%e'", name);
    mysql_function_query(dbHandle, query, false, "", "");
    new str[145];
    format(str,sizeof(str),"[A] %s поставил на админку %s",PLAYER_DATA[playerid][data_NAME],name);
	SendAdminMessage(0x666699FF,str);
}

Ругается на строку:

    mysql_format(dbHandle,query, sizeof(query),"UPDATE `accounts` SET `admlvl` = 'u' WHERE `name` = '%e'", name);

Ошибки:

C:\Users\Александр\Desktop\VirtualTech RP\gamemodes\new.pwn(19006) : error 017: undefined symbol "query"
C:\Users\Александр\Desktop\VirtualTech RP\gamemodes\new.pwn(19006) : error 017: undefined symbol "query"
C:\Users\Александр\Desktop\VirtualTech RP\gamemodes\new.pwn(19006) : error 029: invalid expression, assumed zero
C:\Users\Александр\Desktop\VirtualTech RP\gamemodes\new.pwn(19006) : fatal error 107: too many error messages on one line

 

Share this post


Link to post
Share on other sites

в начало команды new query[70];

Share this post


Link to post
Share on other sites

@MuhammadPawn ошибки ушли но не работает в игре. И код слегка подправил: 

CMD:setadmin(playerid, params[])
{
	new query[70];
    if(antiflood[playerid] > 0) return SendClientMessage(playerid, COLOR_WARNING,"Не флуди!");
    antiflood[playerid]++;
    if(PLAYER_DATA[playerid][data_LOGGED] == false) return SendClientMessage(playerid,COLOR_WARNING,"Вы не авторизованы на сервере!");
    if(PLAYER_DATA[playerid][data_ADMLVL] < 7) return true;
   	if(sscanf(params,"ud[100]",params[0],params[1])) return SendClientMessage(playerid,COLOR_WARNING,"Используйте: /setadmin [ид] [уровень]");
    if(!IsPlayerConnected(params[0]))return  SendClientMessage(playerid,COLOR_WARNING,"Данного ID нет на сервере!");
	if(PLAYER_DATA[params[0]][data_LOGGED] == false)return  SendClientMessage(playerid,COLOR_WARNING,"Данный игрок не прошел авторизацию!");
    if(PLAYER_DATA[params[0]][data_ADMLVL] > PLAYER_DATA[playerid][data_ADMLVL]) return SendClientMessage(playerid, COLOR_WARNING, "Нельзя применить к старшей администрации!");
    mysql_format(dbHandle,query, sizeof(query),"UPDATE `accounts` SET `admlvl` = 'u'");
    mysql_function_query(dbHandle, query, false, "", "");
    new str[145];
    format(str,sizeof(str),"[A] %s поставил на админку %s",PLAYER_DATA[playerid][data_NAME]);
	SendAdminMessage(0x666699FF,str);
	return true;
}

 

Share this post


Link to post
Share on other sites

запрос не правильно делаешь  

mysql_format(dbHandle,query, sizeof(query),"UPDATE `accounts` SET `admlvl` = 'u'");

замени на

mysql_format(dbHandle,query, sizeof(query),"UPDATE `accounts` SET `admlvl` = '%d' WHERE `name` = '%s'",params[0],nameplayer); 

и

if(sscanf(params,"ud[100]",params[0],params[1])) return SendClientMessage(playerid,COLOR_WARNING,"Используйте: /setadmin [ид] [уровень]");

замени на

new nameplayer[MAX_PLAYER_NAME];
if(sscanf(params,"us[24]",params[0],nameplayer)) return SendClientMessage(playerid,COLOR_WARNING,"Используйте: /setadmin [ид] [уровень]");

 

забыл ещё 
 

if(!IsPlayerConnected(params[0]))return  SendClientMessage(playerid,COLOR_WARNING,"Данного ID нет на сервере!");

на

if(!IsPlayerConnected(GetPlayerID(nameplayer)))return  SendClientMessage(playerid,COLOR_WARNING,"Данного ID нет на сервере!");

и в самый низ мода (Если GetPlayerID нету)

stock GetPlayerID(string[])
{
	for(new i = 0; i <= MAX_PLAYERS; i++)
	{
		if(IsPlayerConnected(i) == 1)
		{
			new testname[MAX_PLAYER_NAME];
			GetPlayerName(i, testname, sizeof(testname));
			if(strcmp(testname, string, true, strlen(string)) == 0)
			{
				return i;
			}
		}
	}
	return INVALID_PLAYER_ID;
}

 

Edited by MuhammadPawn

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • Zaire
      By Zaire
      CMD:ban(playerid, params[]) { if(!PlayerInfo[playerid][pLogged]) return true; if(PlayerInfo[playerid][pAdmin] < 3 || AdminLogged[playerid] == false) return true; if(sscanf(params, "uis[64]", params[0], params[1], params[2])) return SendClientMessage(playerid, COLOR_GREY, "Èñïîëüçîâàíèå: /ban [id/íèê èãðîêà] [êîë-âî äíåé] [ïðè÷èíà]"); if(!IsPlayerConnected(params[0]) || params[0] == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GREY, ""TPLAYEROFFLINE""); if(!PlayerInfo[params[0]][pLogged]) return SendClientMessage(playerid, COLOR_GREY, ""TPLAYERNLOGGED""); if(PlayerInfo[params[0]][pDebugUser]) return SendClientMessage(playerid, COLOR_GREY, ""TPLAYEROFFLINE""); if(PlayerInfo[params[0]][pAdmin] >= 1339) return SendClientMessage(playerid, COLOR_GREY, "Ýòîò èãðîê Îñíîâàòåëü! Åãî íå âîçìîæíî çàáëîêèðîâàòü!"); if(params[1] > 365 && params[1] != -1 || params[1] < 1 && params[1] != -1 ) return SendClientMessage(playerid, COLOR_GREY, "Êîë-âî äíåé îò 1 äî 365!"); if(params[1] == -1 && PlayerInfo[playerid][pAdmin] < 1339) return SendClientMessage(playerid, COLOR_GREY, "Âû íå ìîæåòå çàáëîêèðîâàòü èãðîêà íàâñåãäà!"); if(!AddPlayerBan(params[0], playerid, params[1], params[2])) {