doesn't work the command error plz help
#1

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?
Reply
#2

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
Reply
#3

0 is the default virtual world.
Reply
#4

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;
}
Reply
#5

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;
}
Reply
#6

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...
Reply
#7

Код:
  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..
Reply
#8

You better use Joe Staff's command. (:
Reply
#9

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.
Reply
#10

PAWN is a derivative of C, but I used that exact command and it works fine.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)