Please Help Me!
#1

Error:
Код:
C:\Users\BladeGamingYT\Desktop\Headshot.pwn(37) : warning 202: number of arguments does not match definition
C:\Users\BladeGamingYT\Desktop\Headshot.pwn(37) : warning 202: number of arguments does not match definition
C:\Users\BladeGamingYT\Desktop\Headshot.pwn(40) : warning 202: number of arguments does not match definition
C:\Users\BladeGamingYT\Desktop\Headshot.pwn(40) : warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Warnings.
Line 37 and 40:
Код:
#include <a_samp>
#include <zcmd>
#define COLOR_WHITE 0xFFFFFFAA

public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print("		Headshot system by Abdullah420		");
	print("--------------------------------------\n");
	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}



public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
	if(issuerid != INVALID_PLAYER_ID)
	{
		if(IsPlayerConnected(issuerid))
		{
			if(weaponid == 33 || weaponid == 34)
			{
	            if(bodypart == 9)
	            {
	                new playerName[MAX_PLAYER_NAME];
                    GetPlayerName(playerid, playerName, sizeof(playerName));
                    new otherName[MAX_PLAYER_NAME];
                    GetPlayerName(issuerid, otherName, sizeof(otherName));
			        SetPlayerHealth(playerid, 0);
			        GameTextForPlayer(issuerid,"~r~Headshot",2000,3);
			        PlayerPlaySound(issuerid, 17802, 0.0, 0.0, 0.0);
			        SendClientMessage(issuerid, COLOR_WHITE, "{FF0000}You have killed {FFFF00}%s(%i){FF0000} with a Headshot!", playerName, playerid);
			        GameTextForPlayer(playerid,"~r~Headshot",2000,3);
			        PlayerPlaySound(playerid, 17802, 0.0, 0.0, 0.0);
			        SendClientMessage(playerid, COLOR_WHITE, "{FF0000}You have been killed in a Headshot by {FFFF00}%s(%i)!", otherName, issuerid);
			        new msg[400];
                    format(msg, sizeof(msg), "{A7C4E4}%s(%i) has killed %s(%i) with a Headshot!", otherName, issuerid, playerName, playerid);
                    SendClientMessageToAll(COLOR_WHITE, msg);
			    }
			}
		}
    }
    return 1;
}
Both of the sendclientmessage are 37 and 40 but sendclientmessagetoall is 42 please fix it for me! )
Reply
#2

SendClientMessage(playerid,COLOR,"");

this is the normal definitaion for sendclient message if you want format the string you should use like this

new string [];

format(string,sizeof(string),"",valuse);
SendclientMessage(playerid,color,string);
Reply
#3

anyway your code should be like this :

PHP код:

public OnPlayerTakeDamage(playeridissueridFloatamountweaponidbodypart)
{
    if(
issuerid != INVALID_PLAYER_ID)
    {
        if(
IsPlayerConnected(issuerid))
        {
            if(
weaponid == 33 || weaponid == 34)
            {
                if(
bodypart == 9)
                {
                    new 
string[256];
                    new 
playerName[MAX_PLAYER_NAME];
                    
GetPlayerName(playeridplayerNamesizeof(playerName));
                    new 
otherName[MAX_PLAYER_NAME];
                    
GetPlayerName(issueridotherNamesizeof(otherName));
                    
SetPlayerHealth(playerid0);
                    
GameTextForPlayer(issuerid,"~r~Headshot",2000,3);
                    
PlayerPlaySound(issuerid178020.00.00.0);
                    
format(string,sizeof(string),"{FF0000}You have killed {FFFF00}%s(%i){FF0000} with a Headshot!"playerNameplayerid");
                    SendClientMessage(issuerid, COLOR_WHITE,string);
                    GameTextForPlayer(playerid,"
~r~Headshot",2000,3);
                    PlayerPlaySound(playerid, 17802, 0.0, 0.0, 0.0);
                    format(string,sizeof(string),"
{FF0000}You have been killed in a Headshot by {FFFF00}%s(%i)!", otherName, issuerid");
                    
SendClientMessage(playeridCOLOR_WHITE,string);
                    new 
msg[400];
                    
format(msgsizeof(msg), "{A7C4E4}%s(%i) has killed %s(%i) with a Headshot!"otherNameissueridplayerNameplayerid);
                    
SendClientMessageToAll(COLOR_WHITEmsg);
                }
            }
        }
    }
    return 
1;

Reply
#4

You should use format for both the SendClientMessage like you did for SendClientMessageToAll!

Line 37:
Код:
new msg1[400];
format(msg1, sizeof(msg1), "{FF0000}You have killed {FFFF00}%s(%i){FF0000} with a Headshot!", playerName, playerid);
SendClientMessage(issuerid, COLOR_WHITE, msg1);
Line 40:
Код:
new msg2[400];
format(msg2, sizeof(msg2), "{FF0000}You have been killed in a Headshot by {FFFF00}%s(%i)!", otherName, issuerid);
SendClientMessage(playerid, COLOR_WHITE, msg2);
Reply
#5

Thank you so much for help guys! +REP for you all
Reply
#6

Quote:
Originally Posted by UFF
Посмотреть сообщение
You should use format for both the SendClientMessage like you did for SendClientMessageToAll!

Line 37:
Код:
new msg1[400];
format(msg1, sizeof(msg1), "{FF0000}You have killed {FFFF00}%s(%i){FF0000} with a Headshot!", playerName, playerid);
SendClientMessage(issuerid, COLOR_WHITE, msg1);
Line 40:
Код:
new msg2[400];
format(msg2, sizeof(msg2), "{FF0000}You have been killed in a Headshot by {FFFF00}%s(%i)!", otherName, issuerid);
SendClientMessage(playerid, COLOR_WHITE, msg2);
anyway there is no need to make new var for each time

just using one new string[400]; should be enough and each time you can format it
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)