SA-MP Forums Archive
commandtext.... - 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: commandtext.... (/showthread.php?tid=67857)



commandtext.... - thuron - 04.03.2009

hello,
i am having a problem with adding a new command.
i already have this, and this works:
Код:
public OnPlayerCommandText(playerid, cmdtext[])
 {
  if(!strcmp(cmdtext,"/fix",true)) {
    if(IsPlayerAdmin(playerid) && IsPlayerInAnyVehicle(playerid)) {
      SetVehicleHealth(GetPlayerVehicleID(playerid), 1000.0);
    } else {
      SendClientMessage(playerid,COLOR_CRED,"You must be an administrator AND be inside a vehicle to use this command.");
    }
    return 1;
  }
  return 0;
}
but how can i this into there now?:
Код:
if(!strcmp("/Enter", cmdtext, true) && PlayerToPoint(1.5 ,playerid,252.8745,-92.3390,3.5354))
 {
	SetPlayerInterior(playerid, 0);
	SetPlayerPos(playerid,262.1704,-84.3840,65.1329);
	CreatePickup(1239,2,252.8745,-92.3390,3.5354);
	return 1;
 }
 if(!strcmp("/Exit", cmdtext, true) && PlayerToPoint(1.5 ,playerid,262.1704,-84.3840,65.1329))
 {
	SetPlayerInterior(playerid, 0);
	SetPlayerPos(playerid,252.8745,-92.3390,3.5354);
	return 1;
 	}
 return 0;
 }
i just started a new server, so this are the only commands in this script from now. i hope you can help me.

thuron


Re: commandtext.... - ICECOLDKILLAK8 - 04.03.2009

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
 {
  if(!strcmp(cmdtext,"/fix",true))
  {
    if(IsPlayerAdmin(playerid) && IsPlayerInAnyVehicle(playerid))
    {
      SetVehicleHealth(GetPlayerVehicleID(playerid), 1000.0);
    }
    else
    {
      SendClientMessage(playerid,COLOR_CRED,"You must be an administrator AND be inside a vehicle to use this command.");
    }
    return 1;
  }
  if(!strcmp("/Enter", cmdtext, true) && PlayerToPoint(1.5 ,playerid,252.8745,-92.3390,3.5354))
  {
    SetPlayerInterior(playerid, 0);
    SetPlayerPos(playerid,262.1704,-84.3840,65.1329);
    CreatePickup(1239,2,252.8745,-92.3390,3.5354);
    return 1;
  }
  if(!strcmp("/Exit", cmdtext, true) && PlayerToPoint(1.5 ,playerid,262.1704,-84.3840,65.1329))
 {
    SetPlayerInterior(playerid, 0);
    SetPlayerPos(playerid,252.8745,-92.3390,3.5354);
    return 1;
 }
 return 0;
}



Re: commandtext.... - Rks25 - 04.03.2009

Come on theron, you always keep asking same things.
why don't you just learn scripting, search on wiki, think before asking.


Re: commandtext.... - thuron - 05.03.2009

just started, relaxt man.

But that wont work, got 2 errors, tryed it like this to, but even wont work:
Код:
public OnPlayerCommandText(playerid, cmdtext[])
 {
  if(!strcmp(cmdtext,"/fix",true)) {
    if(IsPlayerAdmin(playerid) && IsPlayerInAnyVehicle(playerid)) {
      SetVehicleHealth(GetPlayerVehicleID(playerid), 1000.0);
    } else {
      SendClientMessage(playerid,COLOR_CRED,"You must be an administrator AND be inside a vehicle to use this command.");
    }
    return 1;
  }
  if(!strcmp("/Enter", cmdtext, true) && PlayerToPoint(1.5 ,playerid,252.8745,-92.3390,3.5354))
  {
SetPlayerInterior(playerid, 0);
SetPlayerPos(playerid,262.1704,-84.3840,65.1329);
CreatePickup(1239,2,252.8745,-92.3390,3.5354);
return 1;
  }
  if(!strcmp("/Exit", cmdtext, true) && PlayerToPoint(1.5 ,playerid,262.1704,-84.3840,65.1329))
 {
SetPlayerInterior(playerid, 0);
SetPlayerPos(playerid,252.8745,-92.3390,3.5354);
return 1;
 }
 return 0;
}
got those errors:
Код:
C:\Users\thuron\Desktop\SIR server\gamemodes\SIRRP.pwn(440) : warning 217: loose indentation
C:\Users\thuron\Desktop\SIR server\gamemodes\SIRRP.pwn(446) : warning 217: loose indentation
instead of telling me to search wiki, tell me rks!


Re: commandtext.... - [RP]Rav - 05.03.2009

search pawn documentation

it means you haven't aligned the text in your code properly, nothing serious


Re: commandtext.... - thuron - 05.03.2009

well that are comments that are usefull!! thanks