[ HELP ] warning 209: function "cmd_xx" should return a value
#1

Need help! I'm getting these error on these lines :

pawn Код:
CMD:createsam(playerid,params[])
{
   if(!IsAdmin(playerid,6)) return SendMsg(playerid,5);
   new iD,type;
   if(sscanf(params,"dd",iD,type)) return SendClientMessage(playerid,RED,"Usage : /CreateSam "WHITE_"<SamID> <Sam Type (1/2)> "GRAY_"1 for a normal sam || 2 for a killer sam"),SendClientMessage(playerid,GRAY," *Killer sam - attack all players in the range of the sam base"),SendClientMessage(playerid,GRAY," *Normal sam - only attack planes");
   if(iD > MAX_SAMS || iD < 0)  return SendClientMessage(playerid,RED, " "RED_"» Error « {BABABA}Sam ID is above the limit");
   if(fexist(SamPath(iD))) return SendClientMessage(playerid,RED, " "RED_"» Error « {BABABA}this sam already exists");
   new Float:x,Float:y,Float:z,Float:a;
   GetPlayerPos(playerid,x,y,z);
   GetPlayerFacingAngle(playerid,a);
   new str[128];
   format(str,sizeof(str),""WHITE_"Sam id %d has been "GREEN_"saved",iD);
   SendClientMessage(playerid,RED,str);
   SendClientMessage(playerid,GRAY," -Sam Editor- Type /EditSam to move the sam's position");
   SendClientMessage(playerid,GRAY," -Sam Editor- Type /AddSamKeypad to create a keypad");
   SendClientMessage(playerid,GRAY," -Sam Editor- Type /SamID to get the SamID within your range");
   SendClientMessage(playerid,GRAY," -Sam Editor- Type /SamRange to change the sam's range");

   SAMS[iD][Obj] = CreateDynamicObject(18848, x, y, z,0,0,a);
   SAMS[iD][SamPos][0] = x;
   SAMS[iD][SamPos][1] = y;
   SAMS[iD][SamPos][2] = z;
   SAMS[iD][SamPos][3] = a;
   SAMS[iD][Work] = 0;
   SAMS[iD][MissleFired] = 0;
   SAMS[iD][SDist] = 50.0;

   if(type == 1) SAMS[iD][isKiller] =0;
   else SAMS[iD][isKiller] =1;

   new INI:File2 = INI_Open(SamPath(iD));
   INI_SetTag(File2,"samdata");
   INI_WriteFloat(File2,"sX", x);
   INI_WriteFloat(File2,"sY", y);
   INI_WriteFloat(File2,"sZ", z);
   INI_WriteFloat(File2,"sA", a);
   INI_WriteInt(File2,"Killer",  SAMS[iD][isKiller]);
   INI_Close(File2);
   }
   return 1;
}

Код:
D:\eXtreme GaminG [ STUFFS ]\eXtreme StuntaGe 2\gamemodes\eXs.pwn(23604) : warning 209: function "cmd_createsam" should return a value
D:\eXtreme GaminG [ STUFFS ]\eXtreme StuntaGe 2\gamemodes\eXs.pwn(23605) : error 010: invalid function or declaration
Reply
#2

Remove the bracket over the reurn value
Reply
#3

Use this

PHP код:
CMD:createsam(playerid,params[])
{
   if(!
IsAdmin(playerid,6)) return SendMsg(playerid,5);
   new 
iD,type;
   if(
sscanf(params,"dd",iD,type)) return SendClientMessage(playerid,RED,"Usage : /CreateSam "WHITE_"<SamID> <Sam Type (1/2)> "GRAY_"1 for a normal sam || 2 for a killer sam"),SendClientMessage(playerid,GRAY," *Killer sam - attack all players in the range of the sam base"),SendClientMessage(playerid,GRAY," *Normal sam - only attack planes");
   if(
iD MAX_SAMS || iD 0)  return SendClientMessage(playerid,RED" "RED_"» Error « {BABABA}Sam ID is above the limit");
   if(
fexist(SamPath(iD))) return SendClientMessage(playerid,RED" "RED_"» Error « {BABABA}this sam already exists");
   new 
Float:x,Float:y,Float:z,Float:a;
   
GetPlayerPos(playerid,x,y,z);
   
GetPlayerFacingAngle(playerid,a);
   new 
str[128];
   
format(str,sizeof(str),""WHITE_"Sam id %d has been "GREEN_"saved",iD);
   
SendClientMessage(playerid,RED,str);
   
SendClientMessage(playerid,GRAY," -Sam Editor- Type /EditSam to move the sam's position");
   
SendClientMessage(playerid,GRAY," -Sam Editor- Type /AddSamKeypad to create a keypad");
   
SendClientMessage(playerid,GRAY," -Sam Editor- Type /SamID to get the SamID within your range");
   
SendClientMessage(playerid,GRAY," -Sam Editor- Type /SamRange to change the sam's range");

   
SAMS[iD][Obj] = CreateDynamicObject(18848xyz,0,0,a);
   
SAMS[iD][SamPos][0] = x;
   
SAMS[iD][SamPos][1] = y;
   
SAMS[iD][SamPos][2] = z;
   
SAMS[iD][SamPos][3] = a;
   
SAMS[iD][Work] = 0;
   
SAMS[iD][MissleFired] = 0;
   
SAMS[iD][SDist] = 50.0;

   if(
type == 1SAMS[iD][isKiller] =0;
   else 
SAMS[iD][isKiller] =1;

   new 
INI:File2 INI_Open(SamPath(iD));
   
INI_SetTag(File2,"samdata");
   
INI_WriteFloat(File2,"sX"x);
   
INI_WriteFloat(File2,"sY"y);
   
INI_WriteFloat(File2,"sZ"z);
   
INI_WriteFloat(File2,"sA"a);
   
INI_WriteInt(File2,"Killer",  SAMS[iD][isKiller]);
   
INI_Close(File2);
   return 
1;

Reply
#4

thx bgeditor and karan!
karan this is same wht bgeditor said nvm!
Fixed!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)