SA-MP Forums

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

 
 
Thread Tools Display Modes
Old 23/04/2011, 07:16 PM   #1
Castle
Huge Clucker
 
Castle's Avatar
 
Join Date: Aug 2008
Posts: 331
Reputation: 0
Default /veh - Won't work... :\

I've made this command: http://pastebin.com/7sJhYJEg (Old fashioned I know).
When I type '/veh' without any variables should show: USAGE: /veh [CARID] [COLOR1] [COLOR2]
Instead shows: ** Vehicle model ID can't be below 400 or abor 611!
Could anyone give me a hint where to look?
__________________
Castle is offline  
Old 23/04/2011, 09:08 PM   #2
(SF)Noobanatior
Gangsta
 
Join Date: Dec 2006
Posts: 544
Reputation: 2
Default Re: /veh - Won't work... :\

pawn Code:
new tmp[128];
    new idx,car,color1,color2,scar;
    new Float:X,Float:Y,Float:Z,Float:A;
    tmp=strtok(cmdtext,idx);//<--here
    if(!strcmp("/veh",tmp,true,4)){//<--- then tmp not cmdtext here
        tmp=strtok(cmdtext,idx);
        if(!strlen(tmp))return SendClientMessage(playerid,COLOR_GREY,"USAGE: /veh [CARID] [COLOR1] [COLOR2]"); //No variable typed
        car=strval(tmp);
        if(car<400||car>611)return SendClientMessage(playerid,COLOR_GREY,"** Vehicle model ID can't be below 400 or abor 611!");//carid
        tmp=strtok(cmdtext,idx);
        if(!strlen(tmp))return SendClientMessage(playerid,COLOR_GREY,"USAGE: /veh [CARID] [COLOR1] [COLOR2]");//color 1
        color1=strval(tmp);
        if(color1<-1||color1>255)return SendClientMessage(playerid,COLOR_GREY,"**    Color must be between -1 to 255");
        tmp=strtok(cmdtext,idx);
        if(!strlen(tmp))return SendClientMessage(playerid,COLOR_GREY,"USAGE: /veh [CARID] [COLOR1] [COLOR2]");//color 2
        color1=strval(tmp);
        if(color2<-1||color2>255)return SendClientMessage(playerid,COLOR_GREY,"**    Color must be between -1 to 255");//color 2
        GetPlayerPos(playerid,X,Y,Z);
        GetPlayerFacingAngle(playerid,A);//player position
        scar=CreateVehicle(car,X,Y,Z,A,color1,color2,999999);
        PutPlayerInVehicle(playerid,scar,0);//spawning car
        return 1;
    }
like this you need to strip the command of the front of cmdtext first for it to work properly
(SF)Noobanatior is offline  
Old 24/04/2011, 09:34 AM   #3
Castle
Huge Clucker
 
Castle's Avatar
 
Join Date: Aug 2008
Posts: 331
Reputation: 0
Default Re: /veh - Won't work... :\

Quote:
Originally Posted by (SF)Noobanatior View Post
pawn Code:
new tmp[128];
    new idx,car,color1,color2,scar;
    new Float:X,Float:Y,Float:Z,Float:A;
    tmp=strtok(cmdtext,idx);//<--here
    if(!strcmp("/veh",tmp,true,4)){//<--- then tmp not cmdtext here
        tmp=strtok(cmdtext,idx);
        if(!strlen(tmp))return SendClientMessage(playerid,COLOR_GREY,"USAGE: /veh [CARID] [COLOR1] [COLOR2]"); //No variable typed
        car=strval(tmp);
        if(car<400||car>611)return SendClientMessage(playerid,COLOR_GREY,"** Vehicle model ID can't be below 400 or abor 611!");//carid
        tmp=strtok(cmdtext,idx);
        if(!strlen(tmp))return SendClientMessage(playerid,COLOR_GREY,"USAGE: /veh [CARID] [COLOR1] [COLOR2]");//color 1
        color1=strval(tmp);
        if(color1<-1||color1>255)return SendClientMessage(playerid,COLOR_GREY,"**    Color must be between -1 to 255");
        tmp=strtok(cmdtext,idx);
        if(!strlen(tmp))return SendClientMessage(playerid,COLOR_GREY,"USAGE: /veh [CARID] [COLOR1] [COLOR2]");//color 2
        color1=strval(tmp);
        if(color2<-1||color2>255)return SendClientMessage(playerid,COLOR_GREY,"**    Color must be between -1 to 255");//color 2
        GetPlayerPos(playerid,X,Y,Z);
        GetPlayerFacingAngle(playerid,A);//player position
        scar=CreateVehicle(car,X,Y,Z,A,color1,color2,999999);
        PutPlayerInVehicle(playerid,scar,0);//spawning car
        return 1;
    }
like this you need to strip the command of the front of cmdtext first for it to work properly
Thanks, I didn't script for long time forgot nearly all the shit..
__________________
Castle is offline  
 

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
function doesnt work as i want it to work. legodude Help Archive 0 14/03/2011 02:25 PM
Would this work Kitten Help Archive 10 27/11/2010 07:23 PM
NPC Problem(sometimes work/not work) erik019 Help Archive 4 22/08/2010 03:36 PM
A few methods that may work for you, if you can't get your SA:MP to work! LiberatorXD Client Support 2 09/08/2010 09:36 PM
should FS/GM that work with windows work on linux iggy1 Help Archive 4 01/06/2010 09:53 AM


All times are GMT. The time now is 02:50 AM.


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