Jump to content
  • 0

Putin ajutor va rog? dau +3


MiL-MoY

Question

Inainte de toate v-as ruga frumos sa nu ma luati in ras, dar sunt incepator....candva si voi ati fost la fel....

Problema mea este urmatoarea....cand scriu comanda freeze sau unfreeze , nu-mi apare sa bag ID-ul playerului....ba chiar mie imi da freeze sau unfreeze...ma puteti ajuta va rog sa repar cele 2 comenzi mai jos atasate?

CMD:unfreeze(playerid, params[])
{
    if(pInfo[playerid][pAdmin] < 1 && pInfo[playerid][pHelper] < 1) return SendClientMessage(playerid, COLOR_DARKGRAY, AdminError);
    new playerto;
    if(sscanf(params, "u", playerto)) return SendSyntaxMessage(playerid, "/unfreeze [playerid/name]");
    if(playerto == INVALID_PLAYER_ID || pInfo[playerto][pStatus] != 1) return SendClientMessage(playerid, COLOR_DARKGRAY, "Player not connected.");
    TogglePlayerControllable(playerto, 1);
    if(pInfo[playerid][pAdmin] >= 1) {
    format(AdminWText, sizeof(AdminWText), "AdmCmd: %s has unfreezed %s.", GetName(playerid), GetName(playerto));
    SendAdminMessage(playerid, COLOR_ADMWARNING, AdminWText); format(stmsg[playerto], 58, "Admin %s has unfrozen you.", GetName(playerid)); }
    else {
    format(AdminWText, sizeof(AdminWText), "HelperWarning: %s has unfreezed %s.", GetName(playerid), GetName(playerto));
    SendAdminMessage(playerid, COLOR_HELWARNING, AdminWText); format(stmsg[playerto], 58, "Helper %s has unfrozen you.", GetName(playerid)); }
    SendClientMessage(playerto, COLOR_ORANGE, stmsg[playerto]);
    return 1;
}
CMD:freeze(playerid, params[])
{
    if(pInfo[playerid][pAdmin] < 1 && pInfo[playerid][pHelper] < 1) return SendClientMessage(playerid, COLOR_DARKGRAY, AdminError);
    new playerto;
    if(sscanf(params, "u", playerto)) return SendSyntaxMessage(playerid, "/freeze [playerid/name]");
    if(playerto == INVALID_PLAYER_ID || pInfo[playerto][pStatus] != 1) return SendClientMessage(playerid, COLOR_DARKGRAY, "Player not connected.");
    TogglePlayerControllable(playerto, 0);
    if(pInfo[playerid][pAdmin] >= 1) {
    format(AdminWText, sizeof(AdminWText), "AdmCmd: %s has freezed %s.", GetName(playerid), GetName(playerto));
    SendAdminMessage(playerid, COLOR_ADMWARNING, AdminWText); format(stmsg[playerto], 48, "Admin %s has frozen you.", GetName(playerid)); }
    else {
    format(AdminWText, sizeof(AdminWText), "HelperWarning: %s has freezed %s.", GetName(playerid), GetName(playerto));
    SendAdminMessage(playerid, COLOR_HELWARNING, AdminWText); format(stmsg[playerto], 48, "Helper %s has frozen you.", GetName(playerid)); }
    SendClientMessage(playerto, COLOR_ORANGE, stmsg[playerto]);
    return 1;
}

 

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

CMD:freeze(playerid,params[])
{
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xA9C4E4FF, "You are not an admin!");
    {
            new Target; //defines the playerid we wanna freeze
            if(sscanf(params, "u", Target)) SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: /freeze [playerid]"); //tell sscanf again if the parameters/syntax is wrong to return a special message
            if(!IsPlayerConnected(Target)) //if the ID doesn't exist, return an error-message
                return SendClientMessage(playerid, -1, "ERROR:Player is not connected!");
            if(!sscanf(params, "u", Target))
            {
               //if(Target == playerid) return SendClientMessage(playerid, COLOR_RED, "ERROR: Cant perform this command on yourself!" ); //I wouldn't add this line, because it won't let you perform this CMD on yourself
                //if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1,"ERROR: You cant perform this on Admins that are higher than your level!"); // if the player you're performing this command on has a higher level as you, return a message, you ain't able to freeze him
                new tname[MAX_PLAYER_NAME]; //define the new target-name of the playerid
                GetPlayerName(Target,tname,sizeof(tname)); //get the playername with this function
                new pname[MAX_PLAYER_NAME]; //define the adminname
                GetPlayerName(playerid,pname,sizeof(pname)); //get the adminname with this function
                new tstring[128]; //define the string for the player (victim)
                new pstring[128];// define the string for the admin which is performing
                new astring[128];//define the string for all the players which are online
                format(tstring,sizeof(tstring),"You have been frozen by administrator %s! You cant move!",pname); //this is formatting the player-string, while it's also getting the adminname
                format(pstring,sizeof(pstring),"You have frozen player %s(%d)!",tname,Target); //this is formatting the adminname-string, while it's also getting the playername and his ID(target)
                format(astring,sizeof(astring),"Administrator %s has frozen %s!",pname,tname); //this is formatting the all-string, while it's sending this message to everybody and is getting admin- and playername
                SendClientMessage(Target,-1,tstring);//sends the message to the victim
                SendClientMessage(playerid,-1,pstring);//sends the message to the admin
                SendAdminMessage(-1,astring);//sends the message to everybody
                TogglePlayerControllable(Target,0); //with that function, the player won't be able to mov, while we're using the variable "Target" as the playerid
            }

    }
    return 1;
}

CMD:unfreeze(playerid,params[])
{
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xA9C4E4FF, "You are not an admin!");
    {
            new Target; //defines the playerid we wanna unfreeze
            if(sscanf(params, "u", Target)) SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: /unfreeze [playerid]"); //tell sscanf again if the parameters/syntax is wrong to return a special message
            if(!IsPlayerConnected(Target)) //if the ID doesn't exist, return an error-message
                return SendClientMessage(playerid, -1, "ERROR:Player is not connected!");
            if(!sscanf(params, "u", Target))
            {
               //if(Target == playerid) return SendClientMessage(playerid, -1, "ERROR: Cant perform this command on yourself!" ); //I wouldn't add this line, because it won't let you perform this CMD on yourself
                //if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1,"ERROR: You cant perform this on Admins that are higher than your level!"); // if the player you're performing this command on has a higher level as you, return a message, you ain't able to unfreeze him
                new tname[MAX_PLAYER_NAME]; //define the new target-name of the playerid
                GetPlayerName(Target,tname,sizeof(tname)); //get the playername with this function
                new pname[MAX_PLAYER_NAME]; //define the adminname
                GetPlayerName(playerid,pname,sizeof(pname)); //get the adminname with this function
                new tstring[128]; //define the string for the player (victim)
                new pstring[128];// define the string for the admin which is performing
                new astring[128];//define the string for all the players which are online
                format(tstring,sizeof(tstring),"You have been unfrozen by administrator %s! Now you can move!",pname); //this is formatting the player-string, while it's also getting the adminname
                format(pstring,sizeof(pstring),"You have unfrozen player %s(%d)!",tname,Target); //this is formatting the adminname-string, while it's also getting the playername and his ID(target)
                format(astring,sizeof(astring),"Administrator %s has unfrozen %s!",pname,tname); //this is formatting the all-string, while it's sending this message to everybody and is getting admin- and playername
                SendClientMessage(Target,-1,tstring);//sends the message to the victim
                SendClientMessage(playerid,-1,pstring);//sends the message to the admin
                SendAdminMessage(-1,astring);//sends the message to everybody
                TogglePlayerControllable(Target,1); //with that function, the player will be able to move again, while we're using the variable "Target" as playerid again
                //PlayerInfo[Target][Frozen] = 0;//IMPORTANT:we're getting the variable "[frozen]" out of the enum, and set it's value to "0", the compiler knows now that the player is unfrozen
            }

    }
    return 1;
}

 

// in loc  de /if(!IsPlayerAdmin(playerid)) pui  if(pInfo[playerid][pAdmin] < 1 && pInfo[playerid][pHelper] < 1)

Link to comment
Share on other sites

  • 0
Acum 26 minute, MiL-MoY a spus:

nu functioneaza....aceeasi problema...

CMD:unfreeze(playerid, params[])
{
    if(pInfo[playerid][pAdmin] < 1 && pInfo[playerid][pHelper] < 1) return SendClientMessage(playerid, COLOR_DARKGRAY, AdminError);
    new playerto[25];
    if(sscanf(params, "s[25]", playerto)) return SendSyntaxMessage(playerid, "/unfreeze [playerid/name]");
    if(playerto == INVALID_PLAYER_ID || pInfo[playerto][pStatus] != 1) return SendClientMessage(playerid, COLOR_DARKGRAY, "Player not connected.");
    TogglePlayerControllable(playerto, 1);
    if(pInfo[playerid][pAdmin] >= 1) {
    format(AdminWText, sizeof(AdminWText), "AdmCmd: %s has unfreezed %s.", GetName(playerid), GetName(playerto));
    SendAdminMessage(playerid, COLOR_ADMWARNING, AdminWText); format(stmsg[playerto], 58, "Admin %s has unfrozen you.", GetName(playerid)); }
    else {
    format(AdminWText, sizeof(AdminWText), "HelperWarning: %s has unfreezed %s.", GetName(playerid), GetName(playerto));
    SendAdminMessage(playerid, COLOR_HELWARNING, AdminWText); format(stmsg[playerto], 58, "Helper %s has unfrozen you.", GetName(playerid)); }
    SendClientMessage(playerto, COLOR_ORANGE, stmsg[playerto]);
    return 1;
}
CMD:freeze(playerid, params[])
{
    if(pInfo[playerid][pAdmin] < 1 && pInfo[playerid][pHelper] < 1) return SendClientMessage(playerid, COLOR_DARKGRAY, AdminError);
    new playerto[25];
    if(sscanf(params, "s[25]", playerto)) return SendSyntaxMessage(playerid, "/freeze [playerid/name]");
    if(playerto == INVALID_PLAYER_ID || pInfo[playerto][pStatus] != 1) return SendClientMessage(playerid, COLOR_DARKGRAY, "Player not connected.");
    TogglePlayerControllable(playerto, 0);
    if(pInfo[playerid][pAdmin] >= 1) {
    format(AdminWText, sizeof(AdminWText), "AdmCmd: %s has freezed %s.", GetName(playerid), GetName(playerto));
    SendAdminMessage(playerid, COLOR_ADMWARNING, AdminWText); format(stmsg[playerto], 48, "Admin %s has frozen you.", GetName(playerid)); }
    else {
    format(AdminWText, sizeof(AdminWText), "HelperWarning: %s has freezed %s.", GetName(playerid), GetName(playerto));
    SendAdminMessage(playerid, COLOR_HELWARNING, AdminWText); format(stmsg[playerto], 48, "Helper %s has frozen you.", GetName(playerid)); }
    SendClientMessage(playerto, COLOR_ORANGE, stmsg[playerto]);
    return 1;
}

 

Ce inseamna cuvantul "Unic" este atunci cand Chestia / Obiectul / Idea / etc... nu exista in alta parte.

Copii, nu mai veniti cu vorbe de "Am gamemode unic", nu exista asa ceva, la ora actuala totul este pe net.

Aveti grija pe cine ajutati, majoritatea sunt caini.

Link to comment
Share on other sites

  • 0

@StR_Marian, nu inteleg de ce ai folosit string pentru jucator, dar ma rog.

 

CMD:freeze(playerid, params[])
{
	if(!PlayerInfo[playerid][pAdmin])
		return SendClientMessage(playerid, COLOR_DARKGRAY, AdminError);
	
	new playerFreezed, freezeString[128];
	if(sscanf(params, "u", playerFreezed))
		return SendSyntaxMessage(playerid, "/freeze [playerid or name]");
	
	if(!IsPlayerConnected(playerFreezed))
		return SendClientMessage(playerid, -1, "The player you specified isn't connected."); 
	
	TogglePlayerControllable(playerFreezed, 0);

	format(freezeString, sizeof freezeString, "%s froze player %s.", GetName(playerid), GetName(playerFreezed));
	SendAdminMessage(playerid, COLOR_HELWARNING, freezeString);
	format(freezeString, sizeof freezeString, "You were frozen by %s.", GetName(playerid));
	SendClientMessage(playerid, COLOR_HELWARNING, freezeString);
	return 1;
}

CMD:unfreeze(playerid, params[])
{
if(!PlayerInfo[playerid][pAdmin])
		return SendClientMessage(playerid, COLOR_DARKGRAY, AdminError);
	
	new playerUnfreezed, unfreezeString[128];
	if(sscanf(params, "u", playerUnfreezed))
		return SendSyntaxMessage(playerid, "/freeze [playerid or name]");
	
	if(!IsPlayerConnected(playerUnfreezed))
		return SendClientMessage(playerid, -1, "The player you specified isn't connected.");
	
	TogglePlayerControllable(playerUnfreezed, 1);
	
	format(unfreezeString, sizeof unfreezeString, "%s unfrozen player %s.", GetName(playerid), GetName(playerUnfreezed));
	SendAdminMessage(playerid, COLOR_HELWARNING, unfreezeString);
	format(unfreezeString, sizeof unfreezeString, "You were unfreezed by %s.", GetName(playerid));
	SendClientMessage(playerid, COLOR_HELWARNING, unfreezeString);
	return 1;
}

 

Edited by webby
  • Thanks 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.