SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 19/12/2012, 06:55 AM   #1
EAsT-OAK_510
Huge Clucker
 
EAsT-OAK_510's Avatar
 
Join Date: Jul 2012
Location: Your mom's panties
Posts: 207
Reputation: 15
Default Need help converting a strcmp to zcmd command

This is the code.

pawn Code:
if(strcmp(cmd, "/plate",true)== 0)
{
    new ID = GetPlayerVehicleID(playerid);

    new strings[256];
    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0x00FFFFFF, "You're not in a vehicle");
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /plate <License Plate>");
    else
    {
        format(strings, sizeof(strings), "%s",tmp);
        SetVehicleNumberPlate(ID,strings);
        strmid(CarInfo[VehicleOwned[ID]][cLicense], strings, 0, strlen(strings), 255);
        SetVehicleToRespawn(ID);
        format(strings,sizeof(strings),"{00C0FF}You've changed your plate name to %s please spawn your vehicle again",tmp);
        SendClientMessage(playerid, COLOR_LIGHTRED, strings);
        PlayerPlaySound(playerid, 1133, 0.0, 0.0, 0.0);
        new string[128];
        format(string, sizeof(string), "plates.ini");
        if(!dini_Exists(string))
        {
            dini_Create(string);
            dini_Set(string, "License Plate", tmp);
        }
        SaveCars();

    }
    return 1;
}
EAsT-OAK_510 is offline   Reply With Quote
Old 19/12/2012, 07:02 AM   #2
Windrush
Gangsta
 
Windrush's Avatar
 
Join Date: Aug 2012
Location: asdasdasdasd
Posts: 638
Reputation: 18
Default Re: Need help converting a strcmp to zcmd command

pawn Code:
CMD:plate(playerid,params[])
{
    new ID = GetPlayerVehicleID(playerid);

    new strings[256];
    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0x00FFFFFF, "You're not in a vehicle");
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /plate <License Plate>");
    else
    {
        format(strings, sizeof(strings), "%s",tmp);
        SetVehicleNumberPlate(ID,strings);
        strmid(CarInfo[VehicleOwned[ID]][cLicense], strings, 0, strlen(strings), 255);
        SetVehicleToRespawn(ID);
        format(strings,sizeof(strings),"{00C0FF}You've changed your plate name to %s please spawn your vehicle again",tmp);
        SendClientMessage(playerid, COLOR_LIGHTRED, strings);
        PlayerPlaySound(playerid, 1133, 0.0, 0.0, 0.0);
        new string[128];
        format(string, sizeof(string), "plates.ini");
        if(!dini_Exists(string))
        {
            dini_Create(string);
            dini_Set(string, "License Plate", tmp);
        }
        SaveCars();

    }
    return 1;
}
Windrush is offline   Reply With Quote
Old 19/12/2012, 07:42 AM   #3
EAsT-OAK_510
Huge Clucker
 
EAsT-OAK_510's Avatar
 
Join Date: Jul 2012
Location: Your mom's panties
Posts: 207
Reputation: 15
Default Re: Need help converting a strcmp to zcmd command

Quote:
Originally Posted by windrush View Post
CMDlate(playerid,params[])
{
new ID = GetPlayerVehicleID(playerid);

new strings[256];
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0x00FFFFFF, "You're not in a vehicle");
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /plate <License Plate>");

else
{
format(strings, sizeof(strings), "%s",tmp);
SetVehicleNumberPlate(ID,strings);
strmid(CarInfo[VehicleOwned[ID]][cLicense], strings, 0, strlen(strings), 255);
SetVehicleToRespawn(ID);
format(strings,sizeof(strings),"{00C0FF}You've changed your plate name to %s please spawn your vehicle again",tmp);
SendClientMessage(playerid, COLOR_LIGHTRED, strings);
PlayerPlaySound(playerid, 1133, 0.0, 0.0, 0.0);
new string[128];
format(string, sizeof(string), "plates.ini");
if(!dini_Exists(string))
{
dini_Create(string);
dini_Set(string, "License Plate", tmp);
}
SaveCars();

}
return 1;
}
That's still in strcmp. Thanks for the the reply though..
EAsT-OAK_510 is offline   Reply With Quote
Old 19/12/2012, 07:44 AM   #4
Windrush
Gangsta
 
Windrush's Avatar
 
Join Date: Aug 2012
Location: asdasdasdasd
Posts: 638
Reputation: 18
Default Re: Need help converting a strcmp to zcmd command

That is ZCMD -_-
Windrush is offline   Reply With Quote
Old 19/12/2012, 07:48 AM   #5
EAsT-OAK_510
Huge Clucker
 
EAsT-OAK_510's Avatar
 
Join Date: Jul 2012
Location: Your mom's panties
Posts: 207
Reputation: 15
Default Re: Need help converting a strcmp to zcmd command

Quote:
Originally Posted by windrush View Post
That is ZCMD -_-
lol test this. Please... compile it and test it.
EAsT-OAK_510 is offline   Reply With Quote
Old 19/12/2012, 08:24 AM   #6
[MG]Dimi
High-roller
 
[MG]Dimi's Avatar
 
Join Date: Mar 2011
Location: Serbia
Posts: 1,239
Reputation: 144
Default Re: Need help converting a strcmp to zcmd command

Quote:
Originally Posted by windrush View Post
That is ZCMD -_-
That won't work.

pawn Code:
CMD:plate(playerid,params[])
{
    new ID = GetPlayerVehicleID(playerid);
    new string[128],plate[20];
    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0x00FFFFFF, "You're not in a vehicle");
    if(sscanf(params,"s",plate)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /plate <License Plate>");
    SetVehicleNumberPlate(ID,plate);
    strmid(CarInfo[VehicleOwned[ID]][cLicense], string, 0, strlen(string), 255);
    SetVehicleToRespawn(ID);
    format(string,sizeof(string),"{00C0FF}You've changed your plate to %s.",plate);
    SendClientMessage(playerid, COLOR_LIGHTRED, string);
    PlayerPlaySound(playerid, 1133, 0.0, 0.0, 0.0);
    if(!dini_Exists("plates.ini"))
    {
        dini_Create("plates.ini");
        dini_Set("plates.ini", "License Plate", plate);
    }
    SaveCars();
    return 1;
}
I have removed some logicly stupid things (ex. "plase respawn your car" and you have respawned it line before) and I have used sscanf since it's best to use sscanf with ZCMD
__________________
Scripting Admin/Account/VIP Systems for $$$ using ZCMD,dcmd, Dini, MySQL and sscanf.Scripting IRC Systems with all possible functions. (Echo channels, Chat channels, Admin channels...)Long time Experience with IRC Systems.For both offers PM me
Mini Games ServerServer IP:178.238.236.62:7777
[MG]Dimi is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Converting... ZCMD to STRCMP NeroX98 Scripting Help 13 17/11/2012 10:00 PM
Converting ZCMD To STRCMP Anters14 Scripting Help 5 01/07/2012 02:13 AM
Need help with Converting! [ ZCMD to STRCMP ] Genuine Life Roleplay Scripting Help 7 21/02/2012 05:46 AM
Converting strcmp command to ZCMD JiMadness Scripting Help 6 11/09/2011 01:20 PM


All times are GMT. The time now is 10:29 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.