ZCMD,Problem with making /vehicle [id/name]
#1

Here is my code:

pawn Код:
COMMAND:vehicle(playerid, params[])
    {
        new Float:X, Float:Y, Float:Z;
        new tmp[256];
        new created_vehicle_id;
        tmp = strtok( cmdtext, idx );

        GetPlayerPos( playerid, X, Y, Z );

        created_vehicle_id = CreateVehicle( strval(tmp), X+2, Y+2, Z, 0, 0, 0, -1 );

        new msg[256];
        format(msg,256,"Created vehicle: %d",created_vehicle_id);
        SendClientMessage(playerid,0xAAAAAAAA,msg);

        return 1;
    }
Reply
#2

What's the problem in here? What errors?
As long as you won't provide any kind of infos about: what the hell is going on, give us appeared errors and badly wrote lines, then we may help.

Do you want us to make the whole script for you or to help you?

For this while, all I can write is: you wont spawn vehicle with such command without ever using sscanf
Reply
#3

Quote:
Originally Posted by LetsOWN[PL]
Посмотреть сообщение
What's the problem in here? What errors?
As long as you won't provide any kind of infos about: what the hell is going on, give us appeared errors and badly wrote lines, then we may help.

Do you want us to make the whole script for you or to help you?

For this while, all I can write is: you wont spawn vehicle with such command without ever using sscanf
Код:
C:\Documents and Settings\Korisnik\Desktop\samp03dsvr_R2-800p_win32\gamemodes\0.pwn(109) : error 017: undefined symbol "strtok"
C:\Documents and Settings\Korisnik\Desktop\samp03dsvr_R2-800p_win32\gamemodes\0.pwn(109) : error 033: array must be indexed (variable "tmp")
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
And I don't know how to use sscanf, it's too complicated for me lol
Reply
#4

Assuming that: "And I don't know how to use sscanf, it's too complicated for me"
it will be very difficult for you to make this script at your own

And now error case.
To fix 1st error, you need to download "strtok" include (or you should have it already) and below
Код:
#include <a_samp>
paste this:
Код:
#include <strtok>
The second error is about that you've not indexed tmp (mby to strval, or sth else, i dunno).

I've "scanned" your code again, and in my opinion it's useless - unless you want to spawn vehicles via their ID's not NAMES. If you know all vehicle ids, then you're the best, congratz.

You should write this script in callback OnPlayerCommandPerformed..
Look for tutorials.

Summary of my whole post.

http://lmgtfy.com/?q=vehicle+spawning+tutorial+samp

Have fun, greetz
Reply
#5

Quote:
Originally Posted by LetsOWN[PL]
Посмотреть сообщение
Assuming that: "And I don't know how to use sscanf, it's too complicated for me"
it will be very difficult for you to make this script at your own

And now error case.
To fix 1st error, you need to download "strtok" include (or you should have it already) and below
Код:
#include <a_samp>
paste this:
Код:
#include <strtok>
The second error is about that you've not indexed tmp (mby to strval, or sth else, i dunno).

I've "scanned" your code again, and in my opinion it's useless - unless you want to spawn vehicles via their ID's not NAMES. If you know all vehicle ids, then you're the best, congratz.

You should write this script in callback OnPlayerCommandPerformed..
Look for tutorials.

Summary of my whole post.

http://lmgtfy.com/?q=vehicle+spawning+tutorial+samp

Have fun, greetz
strtok isn't an include file, but a custom function.
Add it at the bottom of your script.
pawn Код:
strtok(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
        index++;
    }
 
    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}
Reply


Forum Jump:


Users browsing this thread: