18.08.2012, 08:23
Please help me fix these codes as when I try them it gives " Invalid ID " or " Player not connected "
slap -
admin pm
freeze and unfreeze -
and guys mostly all the cmds are broken, Please tell me how to fix them if theres a common problem between them.
slap -
Код:
CMD:slap(playerid, params[]) { if(PlayerInfo[playerid][Adminlevel] < 1) return SendClientMessage(playerid,COLOR_ERROR,"[ERROR]: You are not authorized to use this command "); new targetid; if(sscanf(params, "uz", targetid)) return SendClientMessage(playerid, COLOR_SYNTAX, "[SYNTAX]: /slap [PlayerID/PartOfName]"); if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_ERROR, "[ERROR]: Player not connected!"); else { new Float:SLX, Float:SLY, Float:SLZ; GetPlayerPos(targetid, SLX, SLY, SLZ); SetPlayerPos(targetid, SLX, SLY, SLZ+5); PlayerPlaySound(targetid, 1130, SLX, SLY, SLZ+5); new string[128]; new pName[24], pTame[24]; GetPlayerName(playerid,pName,24); GetPlayerName(targetid,pTame,24); format(string,sizeof string,""#COL_YELLOW"[SERVER]"#COL_LRED" %s has been slapped by Administrator %s.",pTame,pName); SendClientMessageToAll(COLOR_RED, string); } return 1; }
Код:
//-----[Admin PM]----- COMMAND:apm(playerid, params[]) { if(PlayerInfo[playerid][Adminlevel] < 1) return SendClientMessage(playerid,COLOR_ERROR,"[ERROR]: You are not authorized to use this command "); new str[128],id,pname[MAX_PLAYER_NAME], Message[128]; if(sscanf(params, "us[128]", id, Message))SendClientMessage(playerid, COLOR_SYNTAX, "[SYNTAX]: /apm [PlayerID/PartOfName] [Message]"); else if(id == INVALID_PLAYER_ID) SendClientMessage(playerid, COLOR_ERROR, "Player not connected!"); else { GetPlayerName(id, str, 24); format(str, sizeof(str), "[ADMIN] %s(%d): %s", str, id, Message); GetPlayerName(id, str, 24); format(str, sizeof(str), "[ADMIN] %s(%d): %s", str, id, Message); SendClientMessage(playerid, COLOR_YELLOW, str); GetPlayerName(playerid, pname, sizeof(pname)); format(str, sizeof(str), "[ADMIN] %s(%d): %s", pname, playerid, Message); SendClientMessage(id, COLOR_YELLOW, str); } return 1; }
Код:
//-----[Freeze]----- CMD:freeze(playerid, params[]) { if(PlayerInfo[playerid][Adminlevel] < 1) return SendClientMessage(playerid,COLOR_ERROR,"[ERROR]: You are not authorized to use this command "); new targetid, string[128]; if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_SYNTAX, "[SYNTAX]: /freeze [PlayerID/PartOfName]"); if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_ERROR, "[ERROR]: Player not connected!"); new pTargetName[24], pName[24]; GetPlayerName(playerid,pName,24); GetPlayerName(targetid,pTargetName,24); format(string, sizeof(string), ""#COL_YELLOW"[SERVER]"#COL_LRED" %s has been frozen by Administrator %s.",pTargetName, pName); SendClientMessageToAll(COLOR_RED,string); TogglePlayerControllable(targetid, 0); return 1; } //-----[Unfreeze]----- CMD:unfreeze(playerid, params[]) { if(PlayerInfo[playerid][Adminlevel] < 1) return SendClientMessage(playerid,COLOR_ERROR,"[ERROR]: You are not authorized to use this command "); new targetid, string[128]; if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_SYNTAX, "[SYNTAX]: /unfreeze [PlayerID/PartOfName]"); if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_ERROR, "[ERROR]: Player not connected!"); new pTargetName[24], pName[24]; GetPlayerName(playerid,pName,24); GetPlayerName(targetid,pTargetName,24); format(string, sizeof(string), ""#COL_YELLOW"[SERVER]"#COL_LRED" %s has been unfrozen by Administrator %s.",pTargetName, pName); SendClientMessageToAll(COLOR_RED,string); TogglePlayerControllable(targetid, 1); return 1; }