warnings -
thefatshizms - 06.06.2012
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 :/
Re: warnings -
Jonny5 - 06.06.2012
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;
}
Re: warnings -
thefatshizms - 06.06.2012
k thanks what about the warnings? cause they make my cmd not work
Re: warnings -
Jonny5 - 06.06.2012
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.
Re: warnings -
thefatshizms - 06.06.2012
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.
Re: warnings -
Jonny5 - 06.06.2012
post line 53
i have no way of telling what line is what from the snippet
is it the sendclientmessage?
Re: warnings -
MadeMan - 06.06.2012
You can't use GetPlayerName like that
https://sampwiki.blast.hk/wiki/GetPlayerName
Re: warnings -
Jonny5 - 06.06.2012
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;
}
Re: warnings -
thefatshizms - 06.06.2012
lol where do i put this :/ i tried in OnFiltersciptinit in the cmd but got errors
Re: warnings -
Faisal_khan - 06.06.2012
Put it anywhere else but not in callbacks.
Re: warnings -
thefatshizms - 06.06.2012
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.
Re: warnings -
Faisal_khan - 06.06.2012
For the str, you have already "str" defined,remove new str[__];.
Paste line 87.