SA-MP Forums Archive
doesn't work the command error plz help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: doesn't work the command error plz help (/showthread.php?tid=108036)



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.