SAMP CMD -----> ZCMD
#1

Hello i want to convert a code from SAMP Team Cmdtext to ZCMD by Zeex

anyway

the code is : http://pastebin.com/J1gWQAnm

Thanks
Reply
#2

Use sscanf. https://sampforum.blast.hk/showthread.php?tid=570927

Then do it like this for every command.

This is your command.
PHP код:
if (strcmp("/propertyinfo"cmdtrue) == 0)
{
    new 
tmp[256];
    
tmp strtok(cmdtextidx);
    if(!
strlen(tmp))
    {
        
SendClientMessage(playerid0xFF0000AA"USE: /propertyinfo [PropertyID]");
        return 
1;
    }
    new 
prop strval(tmp);
    if(!
DoesPropertyExists(prop)) return SendClientMessage(playerid0xFF0000AA"This property does not exists!");
    new 
Float:XFloat:YFloat:Z;
    new 
PriceEarningSellValueName[64], Owner[MAX_PLAYER_NAME], Status[16];
    
GetPropertyInfo(propXYZPriceSellValueEarning);
    
format(Name64"%s"GetPropertyName(prop));
    
format(OwnerMAX_PLAYER_NAME"%s"GetPropertyOwner(prop));
    
format(Status16"%s"GetPropertyStatus(prop));
    new 
str[128];
    
format(str128"Name: %s ** X: %.1f  Y:%.1f ** Z:%.1f"NameXYZ);
    
SendClientMessage(playerid0xFFFFFFAAstr);
    
format(str128"Price: $%d ** SellValue: $%d ** Earnings: $%d"PriceSellValueEarning);
    
SendClientMessage(playerid0xFFFFFFAAstr);
    
format(str128"Owner: %s"Owner);
    
SendClientMessage(playerid0xFFFFFFAAstr);
    
format(str128"Status: %s"Status);
    
SendClientMessage(playerid0xFFFFFFAAstr);
    return 
1;

This is how you should convert.
PHP код:
CMD:propertyinfo(playeridparams[])
{
    new 
prop;
    if(
sscanf(params"i"prop)) return SendClientMessage(playerid0xFF0000AA"USE: /propertyinfo [PropertyID]");
    if(!
DoesPropertyExists(prop)) return SendClientMessage(playerid0xFF0000AA"This property does not exists!");
    new 
Float:XFloat:YFloat:Z;
    new 
PriceEarningSellValueName[64], Owner[MAX_PLAYER_NAME], Status[16];
    
GetPropertyInfo(propXYZPriceSellValueEarning);
    
format(Name64"%s"GetPropertyName(prop));
    
format(OwnerMAX_PLAYER_NAME"%s"GetPropertyOwner(prop));
    
format(Status16"%s"GetPropertyStatus(prop));
    new 
str[128];
    
format(str128"Name: %s ** X: %.1f  Y:%.1f ** Z:%.1f"NameXYZ);
    
SendClientMessage(playerid0xFFFFFFAAstr);
    
format(str128"Price: $%d ** SellValue: $%d ** Earnings: $%d"PriceSellValueEarning);
    
SendClientMessage(playerid0xFFFFFFAAstr);
    
format(str128"Owner: %s"Owner);
    
SendClientMessage(playerid0xFFFFFFAAstr);
    
format(str128"Status: %s"Status);
    
SendClientMessage(playerid0xFFFFFFAAstr);
    return 
1;

EDIT: This "i" in sscanf function stands for integer since property id is an integer.

In the link above that I sent you for sscanf, you can find more specifiers, but I took a screenshot for you.

Reply
#3

:O THANKS !!!
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)