SA-MP Forums Archive
help zcmd command - 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: help zcmd command (/showthread.php?tid=276145)



help zcmd command - NeyMar96 - 12.08.2011

I have a problem with this command

PHP код:
public OnPlayerCommandReceived(playeridcmdtext[])
{
if(
PlayerInfo[playerid][InClan] == 1)
{
new 
Clan[20];
GetPVarString(playerid,"Clan",Clan,sizeof Clan);
Fini_OpenFile(GetClanFile(Clan));
if(!
strcmp(cmdtextFini_GetStr("ClanCmd"), true))
{
if(
IsPlayerInAnyVehicle(playerid)) SetVehiclePos(GetPlayerVehicleID(playerid), Fini_GetFloat("ClanVPosX"), Fini_GetFloat("ClanVPosY"), Fini_GetFloat("ClanVPosZ"));
else 
SetPlayerPos(playerid,Fini_GetFloat("ClanPosX"),Fini_GetFloat("ClanPosY"),Fini_GetFloat("ClanPosZ"));
Fini_CloseFile();
new 
string[70];
format(stringsizeof(string), "~Y~~H~ ] Welcome To Your Clan HQ %s ]",Clan);
GameTextForPlayer(playerid,string,2000,4);
SetPlayerInterior(playerid,0);
return 
SetCameraBehindPlayer(playerid);
}
}
return 
1;

When I do this command, it brings an error "SERVER: Unknown command."


Re: help zcmd command - Darnell - 12.08.2011

Well, ofcourse it is, you didn't make it zCMD.


Re: help zcmd command - NeyMar96 - 12.08.2011

Okay, but how


Re: help zcmd command - Kingunit - 12.08.2011

Don't place ZCMD command in those 'publics'


Re: help zcmd command - PhoenixB - 12.08.2011

Here is the ZCMD command..

pawn Код:
CMD:commandtexthere(playerid, params[])
{
if(PlayerInfo[playerid][InClan] == 1)
{
new Clan[20];
GetPVarString(playerid,"Clan",Clan,sizeof Clan);
Fini_OpenFile(GetClanFile(Clan));
if(!strcmp(cmdtext, Fini_GetStr("ClanCmd"), true))
{
if(IsPlayerInAnyVehicle(playerid)) SetVehiclePos(GetPlayerVehicleID(playerid), Fini_GetFloat("ClanVPosX"), Fini_GetFloat("ClanVPosY"), Fini_GetFloat("ClanVPosZ"));
else SetPlayerPos(playerid,Fini_GetFloat("ClanPosX"),Fini_GetFloat("ClanPosY"),Fini_GetFloat("ClanPosZ"));
Fini_CloseFile();
new string[70];
format(string, sizeof(string), "~Y~~H~ ] Welcome To Your Clan HQ %s ]",Clan);
GameTextForPlayer(playerid,string,2000,4);
SetPlayerInterior(playerid,0);
return SetCameraBehindPlayer(playerid);
}
}
return 1;
}
Hope that helps, place it anywhere but not under any Public Calls unless its a filterscript you will place it under OnFilterScriptInIt


Re: help zcmd command - Riddick94 - 12.08.2011

pawn Код:
CMD:command(playerid, params[])
{
    if(PlayerInfo[playerid][InClan] == 1)
    {
        new Clan[20];
        GetPVarString(playerid,"Clan",Clan,sizeof Clan);
        Fini_OpenFile(GetClanFile(Clan));
        if(!strcmp(cmdtext, Fini_GetStr("ClanCmd"), true))
        {
            if(IsPlayerInAnyVehicle(playerid)) SetVehiclePos(GetPlayerVehicleID(playerid), Fini_GetFloat("ClanVPosX"), Fini_GetFloat("ClanVPosY"), Fini_GetFloat("ClanVPosZ"));
            else SetPlayerPos(playerid,Fini_GetFloat("ClanPosX"),Fini_GetFloat("ClanPosY"),Fini_GetFloat("ClanPosZ"));
            Fini_CloseFile();
            new string[70];
            format(string, sizeof(string), "~Y~~H~ ] Welcome To Your Clan HQ %s ]",Clan);
            GameTextForPlayer(playerid,string,2000,4);
            SetPlayerInterior(playerid,0);
            return SetCameraBehindPlayer(playerid);
        }
    }
    return true;
}
Too late.. but you should use TAB to make your code clearly.


Re: help zcmd command - NeyMar96 - 12.08.2011

Quote:
Originally Posted by PhoenixB
Посмотреть сообщение
Here is the ZCMD command..

pawn Код:
CMD:commandtexthere(playerid, params[])
{
if(PlayerInfo[playerid][InClan] == 1)
{
new Clan[20];
GetPVarString(playerid,"Clan",Clan,sizeof Clan);
Fini_OpenFile(GetClanFile(Clan));
if(!strcmp(cmdtext, Fini_GetStr("ClanCmd"), true))
{
if(IsPlayerInAnyVehicle(playerid)) SetVehiclePos(GetPlayerVehicleID(playerid), Fini_GetFloat("ClanVPosX"), Fini_GetFloat("ClanVPosY"), Fini_GetFloat("ClanVPosZ"));
else SetPlayerPos(playerid,Fini_GetFloat("ClanPosX"),Fini_GetFloat("ClanPosY"),Fini_GetFloat("ClanPosZ"));
Fini_CloseFile();
new string[70];
format(string, sizeof(string), "~Y~~H~ ] Welcome To Your Clan HQ %s ]",Clan);
GameTextForPlayer(playerid,string,2000,4);
SetPlayerInterior(playerid,0);
return SetCameraBehindPlayer(playerid);
}
}
return 1;
}
Hope that helps, place it anywhere but not under any Public Calls unless its a filterscript you will place it under OnFilterScriptInIt

But I want to take the name of the command line 'ClanCmd'
How can I do it?


- PhoenixB - 12.08.2011

Just change CommandTextHere to ClanCmd then hit compile should work + Riddick I hope he knows about tabbing etc, i just couldnt be bothered with it

So now you should have your command like this

pawn Код:
CMD:ClanCmd(playerid, params[])
{
    if(PlayerInfo[playerid][InClan] == 1)
   {
        new Clan[20];
        GetPVarString(playerid,"Clan",Clan,sizeof Clan);
        Fini_OpenFile(GetClanFile(Clan));
        if(!strcmp(cmdtext, Fini_GetStr("ClanCmd"), true))
       {
            if(IsPlayerInAnyVehicle(playerid)) SetVehiclePos(GetPlayerVehicleID(playerid),        Fini_GetFloat("ClanVPosX"), Fini_GetFloat("ClanVPosY"), Fini_GetFloat("ClanVPosZ"));
else SetPlayerPos(playerid,Fini_GetFloat("ClanPosX"),Fini_GetFloat("ClanPosY"),Fini_GetFloat("ClanPosZ"));
Fini_CloseFile();
new string[70];
format(string, sizeof(string), "~Y~~H~ ] Welcome To Your Clan HQ %s ]",Clan);
GameTextForPlayer(playerid,string,2000,4);
SetPlayerInterior(playerid,0);
return SetCameraBehindPlayer(playerid);
}
}
return 1;
}
Etc, you get the idea now, remember to tab it out etc like Riddicks


Re: help zcmd command - NeyMar96 - 12.08.2011

Error: undefined symbol "cmdtext"


Re: help zcmd command - PhoenixB - 12.08.2011

Try this one i forgot to remove the if(strcmp from your code.

pawn Код:
CMD:ClanCmd(playerid, params[])
{
if(PlayerInfo[playerid][InClan] == 1)
{
new Clan[20];
GetPVarString(playerid,"Clan",Clan,sizeof Clan);
Fini_OpenFile(GetClanFile(Clan));
if(IsPlayerInAnyVehicle(playerid)) SetVehiclePos(GetPlayerVehicleID(playerid),                                        Fini_GetFloat("ClanVPosX"), Fini_GetFloat("ClanVPosY"), Fini_GetFloat("ClanVPosZ"));
elseSetPlayerPos(playerid,Fini_GetFloat("ClanPosX"),Fini_GetFloat("ClanPosY"),Fini_GetFloat("ClanPosZ"));
Fini_CloseFile();
new string[70];
format(string, sizeof(string), "~Y~~H~ ] Welcome To Your Clan HQ %s ]",Clan);
GameTextForPlayer(playerid,string,2000,4);
SetPlayerInterior(playerid,0);
return SetCameraBehindPlayer(playerid);
}
}
return 1;
}
Try that,