warnings
#1

got these warnings:

C:\Users\iphone\Desktop\0.3e\filterscripts\Event_F s.pwn(53) : warning 202: number of arguments does not match definition
C:\Users\iphone\Desktop\0.3e\filterscripts\Event_F s.pwn(53) : warning 202: number of arguments does not match definition
C:\Users\iphone\Desktop\0.3e\filterscripts\Event_F s.pwn(53) : warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


3 Warnings.


pawn Code:
CMD:givecar(playerid,params[])
{
    new vehid;
    new id;
    new Float:X, Float:Y, Float:Z, Float:angle;
    if(sscanf(params,"du",vehid, id)) return SendClientMessage(playerid,-1,"Error: - /givecar [vehid] [player id]");
    GetPlayerPos(id, X, Y, Z);
    GetPlayerFacingAngle(id, angle);
    CreateVehicle(vehid, X, Y, Z, angle, 0, 1, -1);
    PutPlayerInVehicle(id, vehid, 0);
    SendClientMessage(playerid, -1, "%s has given you a vehicle", GetPlayerName(playerid));
    return 1;
}
with the send client message i want to do something like "thefatshizms has given you a landstalker"
etc like that but i dont know how lol

oh and the putplayerinvehicle doesnt work :/
Reply
#2

you must format a string BEFORE you use it in SendClientMessage

you cannot use SendClientMessage to format anything.

pawn Code:
CMD:givecar(playerid,params[])
{
    new vehid;
    new id,str[50];
    new Float:X, Float:Y, Float:Z, Float:angle;
    if(sscanf(params,"du",vehid, id)) return SendClientMessage(playerid,-1,"Error: - /givecar [vehid] [player id]");
    GetPlayerPos(id, X, Y, Z);
    GetPlayerFacingAngle(id, angle);
    CreateVehicle(vehid, X, Y, Z, angle, 0, 1, -1);
    PutPlayerInVehicle(id, vehid, 0);
    format(str,sizeof(str),"%s has given you a vehicle", GetPlayerName(playerid));
    SendClientMessage(playerid, -1, str);
    return 1;
}
Reply
#3

k thanks what about the warnings? cause they make my cmd not work
Reply
#4

um the warring was from how you used SendClientMessage

it expects 3 arguments and you where passing 4

your code
pawn Code:
//                1        2            3                                 4
SendClientMessage(playerid, -1, "%s has given you a vehicle", GetPlayerName(playerid));

my code

pawn Code:
//                 1        2    3                                
SendClientMessage(playerid, -1, str);
so you should not have any warnings with the code i posted above.
Reply
#5

when i add your code: C:\Users\iphone\Desktop\0.3e\filterscripts\Event_F s.pwn(53) : warning 202: number of arguments does not match definition
C:\Users\iphone\Desktop\0.3e\filterscripts\Event_F s.pwn(53) : warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Warnings.
Reply
#6

post line 53

i have no way of telling what line is what from the snippet

is it the sendclientmessage?
Reply
#7

You can't use GetPlayerName like that

https://sampwiki.blast.hk/wiki/GetPlayerName
Reply
#8

ahh i missed that as i used ALS to hook my GetPlayerName


heres a stock you can use instead,
I think y_less wrote this one.(im not 100% just trying to give credit where its due)
pawn Code:
stock ReturnPlayerName(playerid)
{
    new pname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, sizeof (pname));
    return pname;
}
Reply
#9

lol where do i put this :/ i tried in OnFiltersciptinit in the cmd but got errors
Reply
#10

Put it anywhere else but not in callbacks.
Reply
#11

C:\Users\iphone\Desktop\0.3e\filterscripts\Event_F s.pwn(80) : warning 219: local variable "str" shadows a variable at a preceding level
C:\Users\iphone\Desktop\0.3e\filterscripts\Event_F s.pwn(87) : warning 202: number of arguments does not match definition
C:\Users\iphone\Desktop\0.3e\filterscripts\Event_F s.pwn(87) : warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


3 Warnings.
Reply
#12

For the str, you have already "str" defined,remove new str[__];.
Paste line 87.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)