SA-MP Forums Archive
[Help]Problem with DCMD_SLAP 1 ERROR - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [Help]Problem with DCMD_SLAP 1 ERROR (/showthread.php?tid=102512)



[Help]Problem with DCMD_SLAP 1 ERROR - Tigerbeast11 - 15.10.2009

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!


Re: [Help]Problem with DCMD_SLAP 1 ERROR - [mad]MLK - 15.10.2009

Under "OnPlayerCommandText" Put

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



Re: [Help]Problem with DCMD_SLAP 1 ERROR - Tigerbeast11 - 15.10.2009

same errors


Re: [Help]Problem with DCMD_SLAP 1 ERROR - _Vortex - 15.10.2009

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


Re: [Help]Problem with DCMD_SLAP 1 ERROR - Tigerbeast11 - 15.10.2009

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?