number of arguments
#1

pawn Код:
warning 202: number of arguments does not match definition
I can't see the problem in my code

pawn Код:
CMD:car(playerid,params[])
{
    if(PlayerInfo[playerid][pAdmin] > 1)
    {
        {
            new Float:pos[4];
            GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
            GetPlayerFacingAngle(playerid, pos[3]);
            new vehicle = CreateVehicle(411, pos[0], pos[1], pos[2], pos[3], 1, 1, 1200);
            PutPlayerInVehicle(playerid, vehicle, 0);
            SendClientMessage(playerid, -1, "Your infernus has been spawned %s.", Name(playerid));
        }
    }
    else
    {
        SendClientMessage(playerid, -1, "You do not have access to this command");
    }
}

stock Name(playerid)
{
    new nname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, nname, sizeof(nname));
    return nname;
}
Reply
#2

The function SendClientMessage has only 3 Parameters (playerid,color,string). So, if you want to format anything you have to use the function "format" before you send the message.
Look here, I have corrected this:
PHP код:
CMD:car(playerid,params[])
{
    if(
PlayerInfo[playerid][pAdmin] > 1)
    {
        new 
Float:pos[4],vehicle,string[145];
        
GetPlayerPos(playerid,pos[0],pos[1],pos[2]);
        
GetPlayerFacingAngle(playerid,pos[3]);
        
vehicle CreateVehicle(411,pos[0],pos[1],pos[2],pos[3],1,1,1200);
        
PutPlayerInVehicle(playerid,vehicle,0);
        
format(string,sizeof string,"You infernus has been spawned %s.",Name(playerid));
        
SendClientMessage(playerid,-1,string);
    }
    else
    {
        
SendClientMessage(playerid, -1"You do not have access to this command");
    }
    return 
1;

Reply
#3

pawn Код:
CMD:car(playerid,params[])
{
    if(PlayerInfo[playerid][pAdmin] > 1)
    {
        {
            new Float:pos[4], str[ 64 ];
            GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
            GetPlayerFacingAngle(playerid, pos[3]);
            new vehicle = CreateVehicle(411, pos[0], pos[1], pos[2], pos[3], 1, 1, 1200);
            PutPlayerInVehicle(playerid, vehicle, 0);
            format( str, sizeof( str ) , "Your infernus has been spawned %s.", Name(playerid) );
            SendClientMessage(playerid, -1, str );
        }
    }
    else
    {
        SendClientMessage(playerid, -1, "You do not have access to this command");
    }
}

stock Name(playerid)
{
    new nname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, nname, sizeof(nname));
    return nname;
}
Format a string, don't try to use formats inside SendClientMessage function.
Reply
#4

Код:
		    SendClientMessage(playerid, -1, "Your infernus has been spawned %s.", Name(playerid));
You can't use SCM like that. User format for strings, int., etc.
Reply
#5

Thank you all greatly appreciated.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)