doesn't work the command error plz help -
Sfinx_17 - 12.11.2009
this is my code
Код:
if (strcmp(cmdtext, "/duel 1", true) == 0)
{
SetPlayerVirtualWorld(playerid, 0);
if(IsPlayerInAnyVehicle(playerid)) //If they are in a vehicle
SetVehicleVirtualWorld(GetPlayerVehicleID(playerid), 0); //Take the vehicle with them
return 1;
}
ok but why in game when i type "/duel 1" doesn't send me in that virtual world?
Re: doesn't work the command error plz help -
Retardedwolf - 12.11.2009
I don't think you can put a space in /duel" "1
or
Indentation
or
You are already in world 0
or
Try SetVehicleVirtualWorld first then SetPlayerVirtualWorld
Re: doesn't work the command error plz help -
Gergo1352 - 12.11.2009
0 is the default virtual world.
Re: doesn't work the command error plz help -
Sfinx_17 - 13.11.2009
i put now the number 1 in my code but why doesn't working yet?
Код:
if (strcmp(cmdtext, "/duel 1", true) == 0)
{
SetPlayerVirtualWorld(playerid, 1);
if(IsPlayerInAnyVehicle(playerid)) //If they are in a vehicle
SetVehicleVirtualWorld(GetPlayerVehicleID(playerid), 1); //Take the vehicle with them
return 1;
}
Re: doesn't work the command error plz help -
Virtual1ty - 13.11.2009
Quote:
Originally Posted by Sfinx_17
i put now the number 1 in my code but why doesn't working yet?
pawn Код:
if (strcmp(cmdtext, "/duel 1", true) == 0) //You cant put a space between "duel" and "1", it has to be either /duel1 or use strval to make it like /duel 1, /duel 2 with only 1 cmd. { SetPlayerVirtualWorld(playerid, 1); if(IsPlayerInAnyVehicle(playerid)) //If they are in a vehicle SetVehicleVirtualWorld(GetPlayerVehicleID(playerid), 1); //Take the vehicle with them return 1; }
|
Re: doesn't work the command error plz help -
Joe Staff - 13.11.2009
You can put a space in the command name, you guys are crazy.
pawn Код:
if (strcmp(cmdtext[1], "duel 1", true) == 0)
{
SetPlayerVirtualWorld(playerid, 1);
if(IsPlayerInAnyVehicle(playerid))SetVehicleVirtualWorld(GetPlayerVehicleID(playerid), 1); //Take the vehicle with them
return 1;
}
Make sure that's under OnPlayerCommandText...
Re: doesn't work the command error plz help -
GaGlets(R) - 13.11.2009
Код:
if (strcmp(cmdtext, "/duel 1", true) == 0)
{
SetPlayerVirtualWorld(playerid, 0);
if(IsPlayerInAnyVehicle(playerid)) //If they are in a vehicle
SetVehicleVirtualWorld(GetPlayerVehicleID(playerid), 0); //Take the vehicle with them
return 1;
}
change that to this
Код:
if (strcmp(cmdtext, "/duel 1", true) == 0)
{
SetPlayerVirtualWorld(playerid, 1);
if(IsPlayerInAnyVehicle(playerid)) {
SetVehicleVirtualWorld(GetPlayerVehicleID(playerid), 1);} //Take the vehicle with them
return 1;
}
You have messed up with { u needed to put it behind if and wirtual world
P.S
in cmd you can put 0-10000000 spaces ... but when u use it you need to write like that..
Re: doesn't work the command error plz help -
Donuts - 13.11.2009
You better use Joe Staff's command. (:
Re: doesn't work the command error plz help -
Daren_Jacobson - 13.11.2009
Quote:
Originally Posted by Joe Staff
You can put a space in the command name, you guys are crazy.
pawn Код:
if (strcmp(cmdtext[1], "duel 1", true) == 0) { SetPlayerVirtualWorld(playerid, 1); if(IsPlayerInAnyVehicle(playerid))SetVehicleVirtualWorld(GetPlayerVehicleID(playerid), 1); //Take the vehicle with them return 1; }
Make sure that's under OnPlayerCommandText...
|
never tried that with strings, but if PAWN is anything like C, that will epically fail.
Re: doesn't work the command error plz help -
Joe Staff - 13.11.2009
PAWN is a derivative of C, but I used that exact command and it works fine.