Interior FS into Gamemode
#1

As the title suggests, I'm trying to insert this script (https://pastebin.com/etcXdhnq), which covers the interior, in my gm, but there is a problem!!

There is a part of the script that must go in public OnPlayerCommandText(playerid, cmdtext[])
I put this on my gm, but when I connect to my server, all the commands of the script don't work(SERVER: unknown command), while if I put the script in filterscript, it works perfectly.

What is the problem
Reply
#2

Are you using ZCMD?
Reply
#3

First and foremost, which command processor do you use? If you aren't using any then it probably isn't working because the array is in the filterscript while the commands are in the gamemode, these two don't have a way of automatically linking unless you make one yourself. A simple solution can be is simply extracting the entirety of the code in your gamemode, rather than using it as a filterscript if you plan to stick to the said filterscript all the time of course.
Reply
#4

@RogueDrifter Yes, I use ZCMD include.

@DaniceMcHarley Thank you for explaining the problem, but how can I do this?
Reply
#5

In my gamemode, I use these type of commands:

Quote:

COMMAND:hidename(playerid, params[])
{
for(new i = GetPlayerPoolSize(); i != -1; --i) ShowPlayerNameTagForPlayer(playerid, i, false);
for(new i = GetPlayerPoolSize(); i != -1; --i) ShowPlayerNameTagForPlayer(i, playerid, false);
// Do something
return 1;
}

CMD:fix(playerid, params[])
{
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1, "You are not in a vehicle!");
if(GetPlayerState(playerid) != 2) return SendClientMessage(playerid, -1, "You are not in the driver seat!");
RepairVehicle(GetPlayerVehicleID(playerid));
SendClientMessage(playerid, -1, "Your vehicle has been sucessfully repaired!");
PlayerPlaySound(playerid, 1133, 0.0, 0.0, 0.0);
return 1;
}

COMMAND:armour(playerid, params[])
{
SetPlayerArmour(playerid, 100);
// Do something
return 1;
}

Reply
#6

change
public OnPlayerCommandText(playerid, cmdtext[])
to
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
Reply
#7

Quote:
Originally Posted by RogueDrifter
Посмотреть сообщение
change
public OnPlayerCommandText(playerid, cmdtext[])
to
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
Ok, now it works, but when I type all the other commands of my gm (COMMAND), appears the message SERVER: unknown command, but the commands work.

Why this?
Reply
#8

Is it possibile to convert this in a CMD command type?
If it is possibile, can you help me?

Quote:

public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[256], idx, tmp[256], string[256];
cmd = strtok(cmdtext, idx);
if(strcmp(cmd, "/int", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, 0xFFFFFFAA, "USAGE: /int [id]");
return 1;
}
new playa;
playa = strval(tmp);
if(playa < 146 && playa >= 0)
{
format(string, sizeof(string), "Int %d: %s", playa, IntName[playa]);
SendClientMessage(playerid, 0xFFFFFFAA, string);
SetPlayerInterior(playerid, IntArray2[playa][0]);
SetPlayerPos(playerid, IntArray[playa][0], IntArray[playa][1], IntArray[playa][2]);
SetPlayerFacingAngle(playerid, IntArray[playa][3]);
return 1;
}
}
return 1;
}
if(strcmp(cmd, "/intlist", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, 0xFFFFFFAA, "USAGE: /intlist [startid]");
return 1;
}
new playa;
playa = strval(tmp);
if(playa < 146 && playa >= 0)
{
format(string, sizeof(string), "Int %d: %s", playa, IntName[playa]);
SendClientMessage(playerid, 0xFFFFFFAA, string);
new intid = playa+1;
while(intid < playa+10)
{
if(intid < 146 && intid >= 0)
{
format(string, sizeof(string), "Int %d: %s", intid, IntName[intid]);
SendClientMessage(playerid, 0xFFFFFFAA, string);
}
intid += 1;
}
return 1;
}
}
return 1;
}
return 0;
}

Reply
#9

Can someone help me? is it possible to do this?
Reply
#10

Quote:
Originally Posted by RogueDrifter
Посмотреть сообщение
change
public OnPlayerCommandText(playerid, cmdtext[])
to
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
You didn't even convert it, read my comment!
change it to this...
PHP код:
public OnPlayerCommandPerformed(playeridcmdtext[], success)
{
new 
cmd[256], idxtmp[256], string[256];
cmd strtok(cmdtextidx);
if(
strcmp(cmd"/int"true) == 0)
{
if(
IsPlayerConnected(playerid))
{
tmp strtok(cmdtextidx);
if(!
strlen(tmp))
{
SendClientMessage(playerid0xFFFFFFAA"USAGE: /int [id]");
return 
1;
}
new 
playa;
playa strval(tmp);
if(
playa 146 && playa >= 0)
{
format(stringsizeof(string), "Int %d: %s"playaIntName[playa]);
SendClientMessage(playerid0xFFFFFFAAstring);
SetPlayerInterior(playeridIntArray2[playa][0]);
SetPlayerPos(playeridIntArray[playa][0], IntArray[playa][1], IntArray[playa][2]);
SetPlayerFacingAngle(playeridIntArray[playa][3]);
return 
1;
}
}
return 
1;
}
if(
strcmp(cmd"/intlist"true) == 0)
{
if(
IsPlayerConnected(playerid))
{
tmp strtok(cmdtextidx);
if(!
strlen(tmp))
{
SendClientMessage(playerid0xFFFFFFAA"USAGE: /intlist [startid]");
return 
1;
}
new 
playa;
playa strval(tmp);
if(
playa 146 && playa >= 0)
{
format(stringsizeof(string), "Int %d: %s"playaIntName[playa]);
SendClientMessage(playerid0xFFFFFFAAstring);
new 
intid playa+1;
while(
intid playa+10)
{
if(
intid 146 && intid >= 0)
{
format(stringsizeof(string), "Int %d: %s"intidIntName[intid]);
SendClientMessage(playerid0xFFFFFFAAstring);
}
intid += 1;
}
return 
1;
}
}
return 
1;
}
if(!
sucess) return 0;
else return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)