SA-MP Forums Archive
help me to convert cmd - 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)
+--- Thread: help me to convert cmd (/showthread.php?tid=628558)



help me to convert cmd - monisoft - 11.02.2017

Hello
I want to transform this code (zcmd to strcmp) please help me how to do it anyway.
PHP код:
CMD:createactor(playerid,params[]) {
    new 
actorName[24],skin;
    if(
sscanf(params,"is[24]",skin,actorName)) return SendClientMessage(playerid,COLOR_GREY,"Usage: /createactor [skinid] [name] ");
    new 
Float:x,Float:y,Float:z,Float:a;
    
GetPlayerPos(playerid,x,y,z);
    
GetPlayerFacingAngle(playerid,a);
    new 
animlib[32];
     new 
animname[32];
    
GetAnimationName(GetPlayerAnimationIndex(playerid),animlib,32,animname,32);
    
sql_CreateActor(actorNameskinx,y,z,aanimlibanimname);
    new 
string[128];
    
format(string,sizeof(string), "New actor created. Skin ID: %i Name: %s. Type /reloadactors to reload all actors",skin,actorName);
    
SendClientMessage(playerid,COLOR_GREY,string);
    return 
true;




Re: help me to convert cmd - Sew_Sumi - 11.02.2017

That's going backwards really. You'd be better off converting the strcmp to zcmd.


Re: help me to convert cmd - aymane123 - 11.02.2017

yup zcmd easy,fast.


Re: help me to convert cmd - monisoft - 11.02.2017

plz help me to convert zcmd to strcmp


Re: help me to convert cmd - RyderX - 11.02.2017

PHP код:
public OnPlayerCommandText(playeridcmdtext[])
{
     if(!
strcmp(cmdtext"/createactor")) 
     {
    new 
actorName[24],skin
    if(
sscanf(params,"is[24]",skin,actorName)) return SendClientMessage(playerid,COLOR_GREY,"Usage: /createactor [skinid] [name] "); 
    new 
Float:x,Float:y,Float:z,Float:a
    
GetPlayerPos(playerid,x,y,z); 
    
GetPlayerFacingAngle(playerid,a); 

    new 
animlib[32]; 
     new 
animname[32]; 

    
GetAnimationName(GetPlayerAnimationIndex(playerid),animlib,32,animname,32); 

    
sql_CreateActor(actorNameskinx,y,z,aanimlibanimname); 

    new 
string[128]; 
    
format(string,sizeof(string), "New actor created. Skin ID: %i Name: %s. Type /reloadactors to reload all actors",skin,actorName); 
    
SendClientMessage(playerid,COLOR_GREY,string); 
        return 
1;
     }
     return 
0;




Re: help me to convert cmd - YouHack - 11.02.2017

As they said ZCMD is too much faster than strcmp, you'll notice it in the future,
anyway here is your CMD ( under OnPlayerCommandText )
PHP код:
if(strcmp(cmd"/createactor"true) == 0)
{
    new 
actorName[24],skin
    if(
sscanf(params,"is[24]",skin,actorName)) return SendClientMessage(playerid,COLOR_GREY,"Usage: /createactor [skinid] [name] "); 
    new 
Float:x,Float:y,Float:z,Float:a
    
GetPlayerPos(playerid,x,y,z); 
    
GetPlayerFacingAngle(playerid,a); 
    new 
animlib[32]; 
     new 
animname[32]; 
    
GetAnimationName(GetPlayerAnimationIndex(playerid),animlib,32,animname,32); 
    
sql_CreateActor(actorNameskinx,y,z,aanimlibanimname); 
    new 
string[128]; 
    
format(string,sizeof(string), "New actor created. Skin ID: %i Name: %s. Type /reloadactors to reload all actors",skin,actorName); 
    
SendClientMessage(playerid,COLOR_GREY,string); 
    return 
1;




Re: help me to convert cmd - monisoft - 12.02.2017

Yes you are right I will have to change their code.
I'm errors when compiling the catalog!
PHP код:
error 017undefined symbol "params" 



Re: help me to convert cmd - Macronix - 12.02.2017

PHP код:
if(strcmp(cmd"/createactor"true) == 0)
{
    new 
actorName[24],skin
    if(
sscanf(cmd[13],"is[24]",skin,actorName)) return SendClientMessage(playerid,COLOR_GREY,"Usage: /createactor [skinid] [name] "); 
    new 
Float:x,Float:y,Float:z,Float:a
    
GetPlayerPos(playerid,x,y,z); 
    
GetPlayerFacingAngle(playerid,a); 
    new 
animlib[32]; 
     new 
animname[32]; 
    
GetAnimationName(GetPlayerAnimationIndex(playerid),animlib,32,animname,32); 
    
sql_CreateActor(actorNameskinx,y,z,aanimlibanimname); 
    new 
string[128]; 
    
format(string,sizeof(string), "New actor created. Skin ID: %i Name: %s. Type /reloadactors to reload all actors",skin,actorName); 
    
SendClientMessage(playerid,COLOR_GREY,string); 
    return 
1;




Re: help me to convert cmd - monisoft - 12.02.2017

Quote:
Originally Posted by Macronix
Посмотреть сообщение
PHP код:
if(strcmp(cmd"/createactor"true) == 0)
{
    new 
actorName[24],skin
    if(
sscanf(cmd,"is[24]",skin,actorName)) return SendClientMessage(playerid,COLOR_GREY,"Usage: /createactor [skinid] [name] "); 
    new 
Float:x,Float:y,Float:z,Float:a
    
GetPlayerPos(playerid,x,y,z); 
    
GetPlayerFacingAngle(playerid,a); 
    new 
animlib[32]; 
     new 
animname[32]; 
    
GetAnimationName(GetPlayerAnimationIndex(playerid),animlib,32,animname,32); 
    
sql_CreateActor(actorNameskinx,y,z,aanimlibanimname); 
    new 
string[128]; 
    
format(string,sizeof(string), "New actor created. Skin ID: %i Name: %s. Type /reloadactors to reload all actors",skin,actorName); 
    
SendClientMessage(playerid,COLOR_GREY,string); 
    return 
1;

Unfortunately it did not work


Re: help me to convert cmd - sKenzi1996 - 12.02.2017

#Didn't read the latest reply! Sorry.