strmid not working (+rep) - 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: strmid not working (+rep) (
/showthread.php?tid=516713)
strmid not working (+rep) -
ScripteRMKD - 01.06.2014
Hi All.I just maked ownership with selling car to player and right now i have problem with strmid...I have function strmid
pawn Код:
strmid(MyVehicle[vehicleid][MyVehOwner], GetName(playerid), 0, strlen(GetName(playerid)), 255);
but when i sell car to player and he accept this vehicle isn't for player which buyed car but its on car seller ... The Vehicle Owner is not changing ... Why ??
Re: strmid not working (+rep) -
ScripteRMKD - 01.06.2014
help ?
Re: strmid not working (+rep) -
Eth - 01.06.2014
pawn Код:
strmid(MyVehicle[vehicleid][MyVehOwner], GetName(playerid), 0, strlen(GetName(id)), 255);
in strlen(getname(playerid)) you have to set it to strlen(getname(theotherplayername))
Re: strmid not working (+rep) -
Riwerry - 01.06.2014
Well, when you want to change string, why are you using strmid? I'd suggest you to use strcpy function. (fastest method for copying strings)
pawn Код:
//To the top of your script
#define strcpy(%0,%1) strcat((%0[0] = '\0', %0), %1)
//Usage: strcpy(dest[], source[], sizeof (dest));
//Then in your code
strcpy(MyVehicle[vehicleid][MyVehOwner], NameOfPlayerToSellCar, sizeof (MyVehicle[]));
NameOfPlayerToSellCar change it for variable of player name that are you going to sell car to.
Re: strmid not working (+rep) -
ScripteRMKD - 02.06.2014
nevermind i fixed ... the problem was in car. .. i put GetPlayerVehicleID(playerid); and now working thanks repped for all