SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 28/05/2013, 03:43 PM   #1
DetoNater
Huge Clucker
 
DetoNater's Avatar
 
Join Date: Feb 2013
Location: !ncredible India
Posts: 253
Reputation: 6
Default Problem in CMD unmute

hi i get these warnings, here is my code
pawn Code:
CMD:unmute(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 1)
    {
        new targetid, string[128];
        {
        if(sscanf(params, "ui", targetid)) SendClientMessage(playerid, C_GREY, "USAGE: /unmute [playerid]");

        format(string, sizeof(string), "ADMIN: %s has been un-muted.", Name(targetid));
        SendClientMessageToAll(C_YELLOW, string);
        SendClientMessage(targetid, C_LGREEN, "You are un-muted!");
        PlayerInfo[targetid][pMuted] = 0;
        }
        if(PlayerInfo[targetid][pMuted] = 1)
        //{
        SendClientMessage(playerid, C_RED, "Player muted!");
        //}
        else if(PlayerInfo[targetid][pMuted] = 0)
        //{
        SendClientMessage(playerid, C_RED, "Player not muted!");
        //}
       
    }
    else SendClientMessage(playerid, C_RED, "You are not authorized to use this command!");
    return 1;
}

Code:
>>>Warnings<<<

D:\GTA SanAndreas\_Samp_\gamemodes\iBon_BF.pwn(3699) : warning 211: possibly unintended assignment
D:\GTA SanAndreas\_Samp_\gamemodes\iBon_BF.pwn(3703) : warning 211: possibly unintended assignment
Pawn compiler 3.2.3664	 	 	Copyright (c) 1997-2006, ITB CompuPhase


2 Warnings.
Help me to fix this, thanks in advance!
__________________

Helpers Needed for the Community!


We're on Hosted Tab
DetoNater is offline   Reply With Quote
Old 28/05/2013, 03:46 PM   #2
Stefano.R
Big Clucker
 
Join Date: Feb 2011
Posts: 56
Reputation: 0
Default Re : Problem in CMD unmute

if(PlayerInfo[targetid][pMuted] == 1)
and
else if(PlayerInfo[targetid][pMuted] == 0)
__________________
Stefano.R is offline   Reply With Quote
Old 28/05/2013, 03:49 PM   #3
Areax
Huge Clucker
 
Areax's Avatar
 
Join Date: Mar 2013
Location: Slovenia
Posts: 464
Reputation: 14
Default Re: Problem in CMD unmute

Try this:

pawn Code:
CMD:unmute(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 1)
    {
        new targetid, string[128];
        {
        if(sscanf(params, "ui", targetid)) SendClientMessage(playerid, C_GREY, "USAGE: /unmute [playerid]");

        format(string, sizeof(string), "ADMIN: %s has been un-muted.", Name(targetid));
        SendClientMessageToAll(C_YELLOW, string);
        SendClientMessage(targetid, C_LGREEN, "You are un-muted!");
        PlayerInfo[targetid][pMuted] = 0;
        }
        if(PlayerInfo[targetid][pMuted] == 1)
        //{
        SendClientMessage(playerid, C_RED, "Player muted!");
        //}
        else if(PlayerInfo[targetid][pMuted] == 0)
        //{
        SendClientMessage(playerid, C_RED, "Player not muted!");
        //}
       
    }
    else SendClientMessage(playerid, C_RED, "You are not authorized to use this command!");
    return 1;
}
Areax is offline   Reply With Quote
Old 28/05/2013, 03:53 PM   #4
jordy.kiesebrink
Big Clucker
 
jordy.kiesebrink's Avatar
 
Join Date: Jun 2008
Location: Netherlands
Posts: 103
Reputation: 5
Default Re: Problem in CMD unmute

The difference between
pawn Code:
PlayerInfo[targetid][pMuted] = 1

and

pawn Code:
PlayerInfo[targetid][pMuted] == 1

is that with the first one you use, you are trying to check with a if statement the pMuted, But in fact you are setting it with = 1..

So to be sure you won't do it wrong anymore you should remind that == means is equel and = is setting something in this case your pMuted to 1

and in a if statement you check if someting is equeal with
Code:
== : equal
!= : not equal 
&& : and 
|| : or
< : lower then
> : higher then
>= : higher or equal
<= : lower or equal
__________________
Developping a server with Nielsbon1, Link comming soon!
jordy.kiesebrink is offline   Reply With Quote
Old 28/05/2013, 03:57 PM   #5
DetoNater
Huge Clucker
 
DetoNater's Avatar
 
Join Date: Feb 2013
Location: !ncredible India
Posts: 253
Reputation: 6
Default Re: Problem in CMD unmute

thanks y'all it's working.
__________________

Helpers Needed for the Community!


We're on Hosted Tab
DetoNater is offline   Reply With Quote
Old 28/05/2013, 04:02 PM   #6
jordy.kiesebrink
Big Clucker
 
jordy.kiesebrink's Avatar
 
Join Date: Jun 2008
Location: Netherlands
Posts: 103
Reputation: 5
Default Re: Problem in CMD unmute

good keep those logic operators in mind to don't confuse them again (logic operator example: && || ==)
__________________
Developping a server with Nielsbon1, Link comming soon!
jordy.kiesebrink is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
/mute and /unmute mittukuttan Scripting Help 4 25/02/2013 08:43 AM
/mute /unmute Cmd Blackazur Scripting Help 6 13/10/2012 06:23 PM
[HELP] Mute, Unmute, Who is muted Larsey123IsMe Help Archive 0 13/12/2010 05:21 PM
Mute and Unmute in dcmd Dolph Help Archive 11 17/04/2010 11:54 AM


All times are GMT. The time now is 05:06 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.