command problem with id 0
#1

the command im trying to excute isnt working for id 0 (Cannot Fishslap yourself)

for(new i = 0; i < MAX_PLAYERS; i++)
Reply
#2

Code please?
Reply
#3

try foreach
Reply
#4

if(strcmp(cmd, "/fishslap", true) == 0)
for(new i = 0; i < MAX_PLAYERS; i++)
{
tmp = strtok(cmdtext, idx);
if(gTeam[playerid] == CIVILIAN || gTeam[playerid] == GAZA)
{
if(playerid != strval(tmp))
{

if(GetDistanceBetweenPlayers(playerid, strval(tmp)) <= 4)

{
if(IsPlayerSpawned(playerid))
{
if(IsPlayerSpawned(strval(tmp)))
{
if(!IsPlayerInAnyVehicle(playerid))
{
if(!IsPlayerInAnyVehicle(strval(tmp)))
{
new ID;
new Float:health;
new Float, Float:y, Float:z, string[100];
if(GetPVarInt(playerid,"CMDABUSE1")>GetTickCount() ) return SendClientMessage(playerid,0xFF0000AA,"Please Wait Before Fish Slapping Someone Again.");
SetPVarInt(playerid,"CMDABUSE1",GetTickCount()+600 00);
GetPlayerPos(ID, x, y, z);
SetPlayerPos(ID, x, y, z+1.5);
GetPlayerHealth(ID,health);
SetPlayerHealth(ID, health-5);
PlayerPlaySound(playerid,1190,0.0,0.0,0.0);
PlayerPlaySound(ID,1190,0.0,0.0,0.0);
format(string, 100, "You have Used Fishslap", name, ID);
SendClientMessage(playerid, COLOR_YELLOW, string);
SetPlayerWantedLevel(playerid,GetPlayerWantedLevel (playerid)+ 1);
return true;
}
else
{
new errormsg[250];
new blown[MAX_PLAYER_NAME];
GetPlayerName(strval(tmp), blown, sizeof(blown));
format(errormsg, sizeof(errormsg), "%s[ID:%d] is in a Vehicle. You cannot fishslap the person inside a vehicle.", blown, strval(tmp));
SendClientMessage(playerid, ERROR, errormsg);
return true;
}
}
else return SendClientMessage(playerid, ERROR, "You cannot fishslap anyone from inside a vehicle.");
}
else
{
new errormsg[250];
new blown[MAX_PLAYER_NAME];
GetPlayerName(strval(tmp), blown, sizeof(blown));
format(errormsg, sizeof(errormsg), "%s[ID:%d] is dead.", blown, strval(tmp));
SendClientMessage(playerid, ERROR, errormsg);
return true;
}
}
else return SendClientMessage(playerid,0xFF0000AA,"Cannot Fishslap When Your Dead.");
}
else return SendClientMessage(playerid,0xFF0000AA,"Nobody Is Close Enough To Fishslap.");
}
else return SendClientMessage(playerid,0xFF0000AA,"You Cannot Slap YourSelf!");
}
else return SendClientMessage(playerid,0xFF0000AA,"Only Civilians Can Fishslap People.");
}
Reply
#5

sry for the mess i dont know how to get the [pawn]
Reply
#6

Ok, check this out:
PHP код:
if(strcmp(cmd"/fishslap"true) == 0)
{
    
tmp strtok(cmdtextidx);
    new 
targetid strval(tmp);
    if(!
IsPlayerConnected(targetid)) return SendClientMessage(playerid, -1"[ERROR]: That player is not connected !");
    
    if(
gTeam[playerid] == CIVILIAN || gTeam[playerid] == GAZA)
    {
        if(
playerid != targetid)
        {
            if(
GetDistanceBetweenPlayers(playeridtargetid) <= 4)
            {
                if(
IsPlayerSpawned(playerid))
                {
                    if(
IsPlayerSpawned(targetid))
                    {
                        if(!
IsPlayerInAnyVehicle(playerid))
                        {
                            if(!
IsPlayerInAnyVehicle(targetid))
                            {
                                new 
ID;
                                new 
Float:health;
                                new 
FloatFloat:yFloat:zstring[100];
                                if(
GetPVarInt(playerid,"CMDABUSE1")>GetTickCount() ) return SendClientMessage(playerid,0xFF0000AA,"Please Wait Before Fish Slapping Someone Again.");
                                
SetPVarInt(playerid,"CMDABUSE1",GetTickCount()+600 00);
                                
GetPlayerPos(IDxyz);
                                
SetPlayerPos(IDxyz+1.5);
                                
GetPlayerHealth(ID,health);
                                
SetPlayerHealth(IDhealth-5);
                                
PlayerPlaySound(playerid,1190,0.0,0.0,0.0);
                                
PlayerPlaySound(ID,1190,0.0,0.0,0.0);
                                
format(string100"You have Used Fishslap"nameID);
                                
SendClientMessage(playeridCOLOR_YELLOWstring);
                                
SetPlayerWantedLevel(playerid,GetPlayerWantedLevel (playerid)+ 1);
                                return 
true;
                            }
                            else
                            {
                                new 
errormsg[250];
                                new 
blown[MAX_PLAYER_NAME];
                                
GetPlayerName(targetidblownsizeof(blown));
                                
format(errormsgsizeof(errormsg), "%s[ID:%d] is in a Vehicle. You cannot fishslap the person inside a vehicle."blowntargetid);
                                
SendClientMessage(playeridERRORerrormsg);
                                return 
true;
                            }
                        }
                        else return 
SendClientMessage(playeridERROR"You cannot fishslap anyone from inside a vehicle.");
                    }
                    else
                    {
                        new 
errormsg[250];
                        new 
blown[MAX_PLAYER_NAME];
                        
GetPlayerName(targetidblownsizeof(blown));
                        
format(errormsgsizeof(errormsg), "%s[ID:%d] is dead."blowntargetid);
                        
SendClientMessage(playeridERRORerrormsg);
                        return 
true;
                    }
                }
                else return 
SendClientMessage(playerid,0xFF0000AA,"Cannot Fishslap When Your Dead.");
            }
            else return 
SendClientMessage(playerid,0xFF0000AA,"Nobody Is Close Enough To Fishslap.");
        }
        else return 
SendClientMessage(playerid,0xFF0000AA,"You Cannot Slap YourSelf!");
    }
    else return 
SendClientMessage(playerid,0xFF0000AA,"Only Civilians Can Fishslap People.");

Reply
#7

thank you for the pawn code
Reply
#8

it still did the same thing MoroDan
Reply
#9

when i try to excute the command it says 'Cannot Fishslap your self"
Reply
#10

Quote:
Originally Posted by MWhite_005
Посмотреть сообщение
when i try to excute the command it says 'Cannot Fishslap your self"
Lol, but you didn't say that :P.
PHP код:
if(strcmp(cmd"/fishslap"true) == 0)
{
    
tmp strtok(cmdtextidx);
    new 
targetid strval(tmp);
    if(!
IsPlayerConnected(targetid)) return SendClientMessage(playerid, -1"[ERROR]: That player is not connected !");
    if(
gTeam[playerid] == CIVILIAN || gTeam[playerid] == GAZA)
    {
        if(
GetDistanceBetweenPlayers(playeridtargetid) <= 4)
        {
            if(
IsPlayerSpawned(playerid))
            {
                if(
IsPlayerSpawned(targetid))
                {
                    if(!
IsPlayerInAnyVehicle(playerid))
                    {
                        if(!
IsPlayerInAnyVehicle(targetid))
                        {
                            new 
ID;
                            new 
Float:health;
                            new 
FloatFloat:yFloat:zstring[100];
                            if(
GetPVarInt(playerid,"CMDABUSE1")>GetTickCount() ) return SendClientMessage(playerid,0xFF0000AA,"Please Wait Before Fish Slapping Someone Again.");
                            
SetPVarInt(playerid,"CMDABUSE1",GetTickCount()+600 00);
                            
GetPlayerPos(IDxyz);
                            
SetPlayerPos(IDxyz+1.5);
                            
GetPlayerHealth(ID,health);
                            
SetPlayerHealth(IDhealth-5);
                            
PlayerPlaySound(playerid,1190,0.0,0.0,0.0);
                            
PlayerPlaySound(ID,1190,0.0,0.0,0.0);
                            
format(string100"You have Used Fishslap"nameID);
                            
SendClientMessage(playeridCOLOR_YELLOWstring);
                            
SetPlayerWantedLevel(playerid,GetPlayerWantedLevel (playerid)+ 1);
                            return 
true;
                        }
                        else
                        {
                            new 
errormsg[250];
                            new 
blown[MAX_PLAYER_NAME];
                            
GetPlayerName(targetidblownsizeof(blown));
                            
format(errormsgsizeof(errormsg), "%s[ID:%d] is in a Vehicle. You cannot fishslap the person inside a vehicle."blowntargetid);
                            
SendClientMessage(playeridERRORerrormsg);
                            return 
true;
                        }
                    }
                    else return 
SendClientMessage(playeridERROR"You cannot fishslap anyone from inside a vehicle.");
                }
                else
                {
                    new 
errormsg[250];
                    new 
blown[MAX_PLAYER_NAME];
                    
GetPlayerName(targetidblownsizeof(blown));
                    
format(errormsgsizeof(errormsg), "%s[ID:%d] is dead."blowntargetid);
                    
SendClientMessage(playeridERRORerrormsg);
                    return 
true;
                }
            }
            else return 
SendClientMessage(playerid,0xFF0000AA,"Cannot Fishslap When Your Dead.");
        }
        else return 
SendClientMessage(playerid,0xFF0000AA,"Nobody Is Close Enough To Fishslap.");
    }
    else return 
SendClientMessage(playerid,0xFF0000AA,"Only Civilians Can Fishslap People.");

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)