Help with Strcmp -
pickle55 - 23.09.2009
I dont know know if any one else has asked this already but I have a question. I am having problems with using strcmp I dont really know how to use it because it doesnt seem to be working for me. None of my commands are working. This is what I have.
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/car", cmdtext, true) == 0)
{
CreateVehicle(506, 0, 0, 0, 0, -1, -1, 0);
return 1;
}
return 0;
}
I am thinking that this should spawn a car. The car is the super gt and Im guessing its supposed to spawn infront of me. If anyone can help me out that would be great. Also if anyone needs more information I can give more if they need it.
Thanks.
Re: Help with Strcmp -
_Vortex - 23.09.2009
for that, you need to get their position, and spawn it where they're located. CreateVehicle doesn't magicaly know where the player is.
Re: Help with Strcmp -
legendario - 23.09.2009
Quote:
Originally Posted by [B
Vortex ]
for that, you need to get their position, and spawn it where they're located. CreateVehicle doesn't magicaly know where the player is.
|
is the position in that case no their
Re: Help with Strcmp -
[HKS]dlegend - 23.09.2009
seen as im a noob i think u could do sumate like
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/car", cmdtext, true) == 0)
{
CreateVehicle(506,(playerpos);
return 1;
}
return 0;
if im wrong ok like i said im a noob
}
Re: Help with Strcmp -
pickle55 - 23.09.2009
Oh yeah! I think it was playerpos ill try that. thanks
Re: Help with Strcmp -
[HKS]dlegend - 23.09.2009
or u could do it so the player is teled to there own car but im work on the own car part
Re: Help with Strcmp -
HuRRiCaNe - 24.09.2009
Under your command :
pawn Код:
new Float: x ,y ,z;
GetPlayerPos(playerid,x,y,z);
CreateVehicle(506,x+2,y,z);
Thats all i think.
Re: Help with Strcmp -
Abernethy - 24.09.2009
Cleaner way.
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/car", cmdtext, true) == 0)
{
new Float:X, Float:Y, Float:Z, Float:R;
GetPlayerPos(playerid, X, Y, Z);
GetPlayerFacingAngle(playerid, R);
CreateVehicle(506, X, Y, Z, R, -1, -1, 600000);
return 1;
}
return 0;
}
Re: Help with Strcmp -
pickle55 - 24.09.2009
When i use the command on the server, it doesnt appear right infront of me. It actually appears ontop of a building a little ways away. If you know how to get it to spawn infront the player please tell me.
Re: Help with Strcmp -
AG Adam - 24.09.2009
See
DainyZxZ's Cars filterscript.
pawn Код:
if (strcmp(cmdtext, "/turismo",true)==0)
{
if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0x33AA33AA, "You are already in a vehicle");
new Float:x,Float:y,Float:z,Float:a;
GetPlayerPos(playerid,x,y,z);
GetPlayerFacingAngle(playerid,a);
CreateVehicle(451,x+1,y+1,z,a,1,1,10000);
return 1;
}