explode
#1

fixed
Reply
#2

This line is the issue
PHP код:
if(type < 1 || type > 13) return SendClientMessage(playerid,COLOR_RED,"Type of explosin [1 to 13]"); 
You have used the wronge ">" keys. What you have stated is "if type less then 1 || type more then 13" that cannot work. Try switching them around. Remember the crocodile "<" eats the biggest number

Also the SAMP Wiki page has a very detailed explination on control structures: https://sampwiki.blast.hk/wiki/Control_Structures
Reply
#3

Quote:
Originally Posted by AaronFarley
Посмотреть сообщение
This line is the issue
PHP код:
if(type < 1 || type > 13) return SendClientMessage(playerid,COLOR_RED,"Type of explosin [1 to 13]"); 
You have used the wronge ">" keys. What you have stated is "if type less then 1 || type more then 13" that cannot work. Try switching them around. Remember the crocodile "<" eats the biggest number

Also the SAMP Wiki page has a very detailed explination on control structures: https://sampwiki.blast.hk/wiki/Control_Structures
same
Reply
#4

PHP код:
COMMAND:explode(playerid, params[])
{
        if(
pData[playerid][Admin] >= 3)
        {
        new 
bombid, type;
        if(
sscanf(params, "ii", bombid,type)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /explode [name/id] [type]");
        if(!
IsPlayerConnected(bombid)) return SendClientMessage(playerid, COLOR_RED, "Player not found.");
        if(
type < 1 || type > 13) return SendClientMessage(playerid,COLOR_RED,"Type of explosin [1 to 13]");
        else
        {
            new 
Float:x,Float:y,Float:z,str[280],ircMsg[280];
            
GetPlayerPos(bombid,x,y,z);
            
CreateExplosion(x,y,z,type,5);
            
format(str,sizeof(str), "You have exploded %s (ID: %d) [Type: %d]",GetName(bombid),bombid, type);
            
SendClientMessage(playerid,COLOR_GREEN,str);
            
format(ircMsg, sizeof(ircMsg), "1,8 Admin %s (ID: %d) exploded %s (ID: %d) with explosin (Type %d)", GetName(playerid), playerid, GetName(bombid),bombid, type);
            
IRC_GroupSay(groupID, IRC_CHANNEL, ircMsg);
        }
    
        return 
1;
        }
        else
        {
           return 
ShowMessage(playerid, COLOR_YELLOW, 1, 3);
        }
} 
Try now, untested though. Also i maybe a lil drunk so ill try and help the best i can
Reply
#5

You were doing it wrong ..

PHP код:
if(sscanf(params, "uu", bombid,type)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /explode [name/id] [type]"); //This is wrong, "u" is for username/playerid 
Replace it with this ...

PHP код:
if(sscanf(params, "ud", bombid,type)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /explode [name/id] [type]");  //Do it like this, "d" is for integer 
Try it .. it should work now.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)