Help: /explode command ERROR
#1

Hello!

Here is my code of /explode command, but when I compile it, I get 1 ERROR and 1 WARNING.

CODE:

PHP код:
CMD:explode(playeridparams[])
{
    if(
gPlayerInfo[playerid][PLAYER_LEVEL] < 3)return SendClientMessage(playeridCOLOR_RED"You are not allowed to use this command!");
    new 
string[128], IDFloat:xFloat:yFloat:z
    if(
sscanf(params"u"ID)) SendClientMessage(playeridCOLOR_RED"Usage: /explode [playerid/name]");
    else if(!
IsPlayerConnected(ID)) SendClientMessage(playeridCOLOR_RED"ERROR: This player is not connected.");
    else 
    {
        
GetPlayerPos(IDxyz); 
        
CreateExplosion(xyz1210.0); 
        
format(string,sizeof(string), "You have exploded %s(%d)."PlayerName(ID), ID); 
        
SendClientMessage(playeridCOLOR_PURPLEstring);
    }
    return;

Reply
#2

Can you post which error and which warning? It will be me much easier to help then.
Reply
#3

Quote:

C:\Users\tadej\Desktop\My Server, Don't touch!\gamemodes\Samp.pwn(514) : error 017: undefined symbol "PlayerName"
C:\Users\tadej\Desktop\My Server, Don't touch!\gamemodes\Samp.pwn(517) : warning 209: function "cmd_explode" should return a value
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.

Here...
Reply
#4

In your code isnt " GetName(bombid), bombid "
Reply
#5

pawn Код:
CMD:explode(playerid, params[])
{
    if(gPlayerInfo[playerid][PLAYER_LEVEL] < 3) return SendClientMessage(playerid, COLOR_RED, "You are not allowed to use this command!");
    new string[128], ID, Float:x, Float:y, Float:z;
    if(sscanf(params, "u", ID)) SendClientMessage(playerid, COLOR_RED, "Usage: /explode [playerid/name]");
    else if(!IsPlayerConnected(ID)) SendClientMessage(playerid, COLOR_RED, "ERROR: This player is not connected.");
    else
    {
        new pName[MAX_PLAYER_NAME];
        GetPlayerName(ID, pName, MAX_PLAYER_NAME);
        GetPlayerPos(ID, x, y, z);
        CreateExplosion(x, y, z, 12, 10.0);
        format(string,sizeof(string), "You have exploded %s(%d).", pName, ID);
        SendClientMessage(playerid, COLOR_PURPLE, string);
    }
    return 1;
}
Reply
#6

Quote:
Originally Posted by SilverKiller
Посмотреть сообщение
pawn Код:
CMD:explode(playerid, params[])
{
    if(gPlayerInfo[playerid][PLAYER_LEVEL] < 3)return SendClientMessage(playerid, COLOR_RED, "You are not allowed to use this command!");
    new string[128], ID, Float:x, Float:y, Float:z;
    if(sscanf(params, "u", ID)) SendClientMessage(playerid, COLOR_RED, "Usage: /explode [playerid/name]");
    else if(!IsPlayerConnected(ID)) SendClientMessage(playerid, COLOR_RED, "ERROR: This player is not connected.");
    else
    {
        new pName[MAX_PLAYER_NAME];
        GetPlayerName(ID, pName, MAX_PLAYER_NAME);
        GetPlayerPos(ID, x, y, z);
        CreateExplosion(x, y, z, 12, 10.0);
        format(string,sizeof(string), "You have exploded %s(%d).", pName, ID);
        SendClientMessage(playerid, COLOR_PURPLE, string);
    }
    return 1;
}
Thanks, it's working REP+
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)