[Qeustion]about (I don't know how that call) - 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: [Qeustion]about (I don't know how that call) (
/showthread.php?tid=293869)
[Qeustion]about (I don't know how that call) -
juraska - 30.10.2011
Hi,
How that called and how it using
Код:
new test[2][2]={
{"text",11},
{"text",11}
};
Код:
new myvehicleid[3][1]={
{411},
{412},
{413}
};
And exsample I need how to create these id's cars using key_states
Thanks, thanks in advance
AW: [Qeustion]about (I don't know how that call) -
Nero_3D - 30.10.2011
That are arrays, there is a sa-mp wiki page about them
But what you want to do is something different, you want to assign vehicleids for you or for a group, dont you ?
Re: [Qeustion]about (I don't know how that call) -
juraska - 30.10.2011
First thanks.
I want make vehicle id list, witch i could vehile spawing
example
new vData[4][1]=
{
{565},
{ 589 },
{561},
{ 584 }
};
if(PREESED(key_up))
{
// and i want to make here car in succession using vData array
}
AW: [Qeustion]about (I don't know how that call) -
Nero_3D - 30.10.2011
Ah okay, that isnt difficult
Since you only got one row you dont need a second dimension
pawn Код:
// stock: Like new, just that the code doesnt get compiled if not used
// const: Declares the data as constant (cant be changed) => better performance
stock const vData[] = {
565, 589, 561, 584
};
Thats enough
And now to the key code
pawn Код:
// In some timer because up, down, left and right doesnt get called by OnPlayerKeyStateChange
new
keys,
updown,
leftright;
if(GetPlayerKeys(playerid, keys, updown, leftright)) { // checks if the player is connected
static // static: creates a local variable which behaves like a global one
vDataIdx[MAX_PLAYERS];
if(updown != 0) { // if the player isnt standing
// Example code - a print statement which shows the current model
print("Current vehicle model %d", vData[vDataIdx[playerid]]);
// Just do here whatever you want, for a vehicle selection use CreateVehicle
if(updown < 0) { // if the player pressed forward
if(++vDataIdx[playerid] == sizeof vData) { // if we reach the first invalid index
vDataIdx[playerid] = 0; // We set it to the first valid index
}
} else { // ... pressed backwards
if(--vDataIdx[playerid] == -1) { // if we reach the first invalid index
vDataIdx[playerid] = (sizeof vData - 1); // We set it to the last valid index
}
}
}
}