[Help]Problem with DCMD_SLAP 1 ERROR
#1

Hey guys!

I get this error when i compile...
Код:
C:\Users\USER\Desktop\server\filterscripts\ladmin.pwn(2682) : warning 209: function "dcmd_slap" should return a value
C:\Users\USER\Desktop\server\filterscripts\ladmin.pwn(2682) : error 010: invalid function or declaration
Here is the code...
Код:
dcmd_slap(playerid,params[]) {
  if(PlayerInfo[playerid][LoggedIn] == 1) {
		if(PlayerInfo[playerid][Level] >= 2) {
		  new tmp[256], tmp2[256], Index;		tmp = strtok(params,Index), tmp2 = strtok(params,Index);
		  if(!strlen(params)) return SendClientMessage(playerid, orange, "USAGE: /slap [playerid] [reason]");
	  	new player1, playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128];
			player1 = strval(tmp);
			
			
  			new Float:Health, Float:x, Float:y, Float:z; GetPlayerHealth(player1,Health);
			GetPlayerPos(player1,x,y,z); SetPlayerPos(player1,x,y,z+2); PlayerPlaySound(playerid,1190,0.0,0.0,0.0); PlayerPlaySound(player1,1190,0.0,0.0,0.0);

			if(strlen(tmp2)) {
			GetPlayerName(player1, playername, sizeof(playername));		GetPlayerName(playerid, adminname, sizeof(adminname));
			format(string,sizeof(string),"Adminstrator %s has slapped %s (%d) for: %s",adminname,playername,playerid, params[2]); return	SendClientMessageToAll(orange,string); }
			} else {
      new player1, playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128];
  			GetPlayerName(player1, playername, sizeof(playername));		GetPlayerName(playerid, adminname, sizeof(adminname));
			format(string,sizeof(string),"Adminstrator %s has slapped %s (%d) for [No Reason Defined]",adminname, playername, playerid); return 	SendClientMessageToAll(orange,string); }
		} else return SendClientMessage(playerid,orange,"ERROR: You are not a high enough level to use this command");
	} else return SendClientMessage(playerid, orange, "ERROR: You must be logged in to use this command");
}
If you find any error with this, plz help me!
Reply
#2

Under "OnPlayerCommandText" Put

Код:
dcmd(slap, 4, cmdtext);
Reply
#3

same errors
Reply
#4

Quote:
Originally Posted by Tigerbeast11
same errors
pawn Код:
dcmd_slap(playerid,params[]) {
  if(PlayerInfo[playerid][LoggedIn] == 1) {
        if(PlayerInfo[playerid][Level] >= 2) {
          new tmp[256], tmp2[256], Index;       tmp = strtok(params,Index), tmp2 = strtok(params,Index);
          if(!strlen(params)) return SendClientMessage(playerid, orange, "USAGE: /slap [playerid] [reason]");
        new player1, playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128];
            player1 = strval(tmp);
           
           
            new Float:Health, Float:x, Float:y, Float:z; GetPlayerHealth(player1,Health);
            GetPlayerPos(player1,x,y,z); SetPlayerPos(player1,x,y,z+2); PlayerPlaySound(playerid,1190,0.0,0.0,0.0); PlayerPlaySound(player1,1190,0.0,0.0,0.0);

            if(strlen(tmp2)) {
            GetPlayerName(player1, playername, sizeof(playername));     GetPlayerName(playerid, adminname, sizeof(adminname));
            format(string,sizeof(string),"Adminstrator %s has slapped %s (%d) for: %s",adminname,playername,playerid, params[2]); return    SendClientMessageToAll(orange,string); }
            } else {
      new player1, playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128];
            GetPlayerName(player1, playername, sizeof(playername));     GetPlayerName(playerid, adminname, sizeof(adminname));
            format(string,sizeof(string),"Adminstrator %s has slapped %s (%d) for [No Reason Defined]",adminname, playername, playerid); return     SendClientMessageToAll(orange,string); }
        } else return SendClientMessage(playerid,orange,"ERROR: You are not a high enough level to use this command");
    } else return SendClientMessage(playerid, orange, "ERROR: You must be logged in to use this command");
    return 1;
}
Try that :P
Reply
#5

Quote:
Originally Posted by [B
Vortex ]
Quote:
Originally Posted by Tigerbeast11
same errors
pawn Код:
dcmd_slap(playerid,params[]) {
  if(PlayerInfo[playerid][LoggedIn] == 1) {
        if(PlayerInfo[playerid][Level] >= 2) {
          new tmp[256], tmp2[256], Index;       tmp = strtok(params,Index), tmp2 = strtok(params,Index);
          if(!strlen(params)) return SendClientMessage(playerid, orange, "USAGE: /slap [playerid] [reason]");
        new player1, playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128];
            player1 = strval(tmp);
           
           
            new Float:Health, Float:x, Float:y, Float:z; GetPlayerHealth(player1,Health);
            GetPlayerPos(player1,x,y,z); SetPlayerPos(player1,x,y,z+2); PlayerPlaySound(playerid,1190,0.0,0.0,0.0); PlayerPlaySound(player1,1190,0.0,0.0,0.0);

            if(strlen(tmp2)) {
            GetPlayerName(player1, playername, sizeof(playername));     GetPlayerName(playerid, adminname, sizeof(adminname));
            format(string,sizeof(string),"Adminstrator %s has slapped %s (%d) for: %s",adminname,playername,playerid, params[2]); return    SendClientMessageToAll(orange,string); }
            } else {
      new player1, playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128];
            GetPlayerName(player1, playername, sizeof(playername));     GetPlayerName(playerid, adminname, sizeof(adminname));
            format(string,sizeof(string),"Adminstrator %s has slapped %s (%d) for [No Reason Defined]",adminname, playername, playerid); return     SendClientMessageToAll(orange,string); }
        } else return SendClientMessage(playerid,orange,"ERROR: You are not a high enough level to use this command");
    } else return SendClientMessage(playerid, orange, "ERROR: You must be logged in to use this command");
    return 1;
}
Try that :P
big fail...

2 errors....
"invalid function or declaration"

wtf?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)