SA-MP Forums Archive
Is this imposible ? - 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: Is this imposible ? (/showthread.php?tid=164203)



Is this imposible ? - mihaitza55 - 30.07.2010

Hey guys, me again with a friendly question... But I think it`s impossible
So here`s what i`m trying to do:

A command, let`s say, /replace oldname newname
And what it does, it replaces ALL the words "oldname" in the script, with "newname"

Ex: /replace PlayerOne PlayerTwo

So, everything in my GameMode (script) will be replaced from PlayerOne to PlayerTwo

This is because i`m trying to make a car seller system, selling the car from PlayerOne to PlayerTwo by replacing his Personal Car Name in the GM from the seller to the person he sold the car to... I hope u understand...

Is it possible? If yes, an idea or something ?


Re: Is this imposible ? - WillyP - 30.07.2010

yes it is.

do crtrl+h,

a little box comes up fill it in

and press yes to all

so somewhere in the script you might have hello and after yu did that, the hello will be changed to hello1 or w.e you change it to


Re: Is this imposible ? - mihaitza55 - 30.07.2010

No, u didn`t get it, i`m trying to make a command so the player will automaticly make the script replace itself, ofcourse i could do it with ctrl+h i knew that, but i`m trying to save the scripter (me) some time...
So basicly i`m trying to make ctrl+h a command ingame, so the player replaces something INSIDE the script from InGame !


Re: Is this imposible ? - Hiddos - 30.07.2010

Will use some time, but something like this might work:

pawn Код:
SetPVarInt(p1,"Kills",GetPVarInt(p2,"Kills"));
Etc.


Re: Is this imposible ? - mihaitza55 - 30.07.2010

So if i try

pawn Код:
SetPVarInt(p1,"PlayerOne",GetPVarInt(p2,"PlayerTwo"));
Then PlayerOne will be replaced with PlayerTwo?
Cool... I`ll try and reply back


Re: Is this imposible ? - mihaitza55 - 30.07.2010

I`m trying ...

pawn Код:
if(strcmp(cmd, "/replace", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "/replace [PlayerName]");
                return 1;
            }
            if (PlayerInfo[playerid][pAdmin] >= 1)
            {
                if(playerid != INVALID_PLAYER_ID)
                {
                    SetPVarInt(playerid,"RazVan",tmp); // ERROR LINE (27460)
                }
                else
                {
                    SendClientMessage(playerid, COLOR_GRAD2, "Player not online...");
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD2, "U are not an admin.");
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_GRAD2, "U didn`t connect yet.");
        }
    }
I don`t think it`s right but it should look something like that
Errors :
D:\SAMP Server R7\gamemodes\arth.pwn(27460) : error 035: argument type mismatch (argument 3)

Can someone correct me? Hiddos? Help ?
It would be really great if i could do this and i would definetly release it on sa-mp.com !

So... RazVan is an owner of a car, and when i would type /replace MihaiTZa55, RazVan`s car would be replaced as MihaiTZa55`s car (mine) but i got that error... Help ?

Should I user format( with the %s or somthing ? or something ?


Re: Is this imposible ? - mihaitza55 - 30.07.2010

*bump* cmon guys let`s make this work... it would be a really awesome car dealer ship system


Re: Is this imposible ? - xyly - 30.07.2010

First you have to know that is a integer and a string then you will find your answer to your problem.


Re: Is this imposible ? - Kevin_Joshen - 30.07.2010

Quote:
Originally Posted by Lolrofl
Посмотреть сообщение
yes it is.

do crtrl+h,

a little box comes up fill it in

and press yes to all
THANK YOU!! You just saved me from going through 4000+lines of converting "createobject" to "createdynamicobject"

Thank you!
-Kevin


Re: Is this imposible ? - Kar - 30.07.2010

Quote:
Originally Posted by Kevin_Joshen
Посмотреть сообщение
THANK YOU!! You just saved me from going through 4000+lines of converting "createobject" to "createdynamicobject"

Thank you!
-Kevin
http://www.convertffs.com/

even faster.